Converting a list to a string,file2.write(' '.join(buffer))