Use csv.writer to write csv output