Hello Dave, you are 21 years old!
As you can see the scripts output was written to file.txt, but the last thing written to it is gone! That's because the > operator will wipe out anything in the file when you use it. If you want to concatenate it with the file, use the >> operator.
This was printed twice because it was appended to the file.