added write to output file