You are trying to replace the complete text of the second file that occurs in the first. But that text does not exist in the first file, only a part of it. You should read the second file line by line and try the replace on just the text of that line. Something like:
import re
newcontent: str=''
oldcontent: str=''
with open('C:\Temp\\test1.log', 'r') as content_file:
newcontent = content_file.read()
def replaceData(txt):
with open('C:\Temp\\test2.log', "r") as fout:
for line in fout:
txt=txt.replace(line,'')
replaceData(newcontent)