write to output file in append mode