The following is my replace line function:
def replace_line(file_name, num, replaced):
    f = open(file_name, 'r', encoding='utf-8')
    lines = f.readlines()
    lines[num] = replaced
    f.close()
    f = open(file_name, 'w', encoding='utf-8')
    f.writelines(lines)
    f.close()
I am using this following line to run my code:
replace_line('Store.txt', int(line), new)
When I run my code, it replaces that line however it also removes everything after that line. For example, if this was my list:
 
    