in reply to append text to a file
Another approach is to split the data collection from the report generation. Put this data: $fileone,$oldTime,$newTime
out using a .cvs format. Read that file and generate a report for the humans whenever you need to.