write to output file