What I understand from your code is that compare the first line of file1 to all the lines in file2.
What you actually want to do is to read a line in file1, compare it to file2 if it is different reutun "different" and finish. Otherwise, finish comparing all the lines and return equal.
I don't like the answers in how to compare lines in two files are same or different in python since they load all the files in the memory.
What I would do is something like
f1 = open("file1")
f2 = open("file2")
line1 = next(f1)
line2 = next(f2)
found_different = False
while line1 and line2:
if line1 != line2:
found_different = True
break
line1 = next(f1)
line2 = next(f2)
if not line1 and not line2 and not found_different:
print "equal"
else:
print "different"