My point was no need to build a string before printing it to a file as a whole. Your first example just needed to PRINT # to a file rather than the screen. Small code reduction but both result in the same output.
I originally did it like that, but was concerned that I was modifying the file system while looping over the directory contents.
Also, doing it as you suggest means I'll be making multiple calls to add a single line to the file, instead of a single call at the end to write all of the lines at once.
The data being saved is small in this case, but if it were a large data set I think the performance hit would be noticeable. File I/O can be expensive, as you know....
If the internal list were exposed, then the need for building the string would be eliminated, I could just PRINT # the list in a loop and call it a day.
AIR.