with open('in.txt') as fin:
    with open('out.txt', 'w') as fout:
        index = 0
for line in iter(fin.readline, ''):
    fout.write(line.replace('\n', ', ' + str(data[index]) + '\n'))
add a new column to an existing csv file