Yep
I don't have time to write any code, but I can give you some general directions. There may be multiple methods and this is merely one.
Open the file using "open", loop through each line, saving it to a local variable, until you find the line you want using "read-line", as soon as you find the target line, add your line to replace to your list of lines, then finish reading the file using "read-line" saving the line data to your local variable, close the file using "close" and immediately reopen that file in write mode, then write all your saved variables to that file and close the file.