The text you want to correct in the erroneous files spans more than one line. If you want to use a regex to correct the text you can't process the file line by line as you will never find a match. Instead, you would have to slurp the whole file into a single string so that you can do line spanning matches.
If you want to process by reading a line at a time from the uncorrected file and printing to a corrected file, perhaps because the files are large, then you could use a sort of state engine. Remember the last line printed. Don't print the current line if it is eq (string equality) to both the last line and the text (including the newline so you will probably need to use a double-quoting construct (qq{ ... }) to initialise it) you want to remove, otherwise print it.