script to append fit result to the start of a file