why do you wait to write file.txt?
instead of may you mail to yourself with contenst of the file.txt
in next cron work time is refreshes file.txt (overwrite file.txt) and you look the new mail for new informations
Maybe write to file_temp.txt and rename the file to the correct name when you have finished. Assuming that the next stage is in another cron that stage will need code to wait until the file is available.