Need help with python homework

Hi everyone! Need help with one python task, I’ve tried to do it several times, but nothing works. If someone knows the solution, pls let me know, I’ll be very grateful!

Program: program asks to enter the file name “school.txt”, reads the names of schools from the file, displays the names of schools with serial numbers on the screen, asks the user which school to add to the file, adds the school name entered by the user to the end of the file without changing the contents of the file.