You'll want to use Display Actions/Show File (which will download a file to the client), rather than Write Resource (which can be used to write a file on the server file system, or to another server).
Documentation for Show File is available here. A simple demo of it is provided in the Examples sample application (See the File Library demo) included with the installer, and which can also be downloaded from here.
The Save To File button can be implemented along the lines of the following screenshot (this is one of several possible implementations):
Retrieve Records will query the database, optionally using the parameters passed from the button model.
Convert Record to Line can be implemented as follows:
Convert Lines to Text Buffer can be implemented as follows:
Make sure to pay special attention to the repetitive elements.
For best results, use the Firefox browser..