letter_file = open("spam.txt", "r")
letter_text = letter_file.read()

name_file = open("names.txt", "r")
names = name_file.readlines()

for name in names:
    out_letter = letter_text.replace("<winner>", name)
    out_file = open(name+".txt", "w")
    out_file.write(out_letter)
    out_file.close()
