write script to output csv rewrite