

If, however, you delete your output file, run the script, and it appears again, then something is wrong. If you keep running your script without deleting the output file, and the entire contents of the output file are what you posted, then nothing is being added to the file and nothing is wrong with your script - it is doing exactly what you are telling it to.

Are you aware that FileAppend adds to a file if it already exists and creates it if it doesn't.

Now, to the final bit of logic where the file is actually written to. Is this the entire contents of your file? If so, than nothing from within your loop was added to it, so your comparison logic is correct. ItemA ItemB ItemC ItemD ItemE ItemF ItemG After execution, you will get an output.txt, the content is below.
