Jay,
You might get good mileage from the ‘read_file’ and ‘write_file’ TCL commands. That would allow your program to read the entire contents of the file, append your new segments and then write the data back to the file.
The difference is that you read the whole file instead of just records out of the file.