We can print to a file in essentially the same way we print to the screen.
In the simplest case, we create the entire file with one command; we
give the file name as the initial left hand operand of <<,
and we close the file with close. Files must be closed
before they can be used for something else.
i1 : "testfile" << 2^100 << endl << close
o1 = --closed file--
o1 : File
i2 : value get "testfile"
o2 = 1267650600228229401496703205376
More complicated files may require printing to the file multiple times. One
way to handle this is to assign the open file created the first time we
use << to a variable, so we can use it for subsequent print operations
and for closing the file.