write output.