in reply to Printing out to a .txt file.

Have you tried redirecting STDOUT to the file on the command line? I believe that even the native MS-DOS Prompt shell supports this (but I would still prefer a windows port of bash). Just add  >> your\file.name at the end of the command line when you run your script.

Single angle bracket would truncate an existing file before writing to it, so the file content would be only the output of the current run; double angle brackets will append to the end of an existing file, or create a new file if it doesn't exist yet -- just like in the perl "open" call (which is, after all, designed to mimic shell usage in this regard).