First, review a tutorial or two on paths so you know where you are putting the file(s). Then you can use
redirection to steer the output from one program, or chain of programs, into a file.
What does your script look like so far? Please use [code] [/code] tags to preserve indentation as you post it.