Python Write To Csv In Loop