In this code
if (fileLines1[i] != fileLines2[i])
if fileLines2 is smaller than fileLines1 then you'll get that error. Let's say there are 5 items in 1 and 3 in 2. When you come to look at the 4th element you'll try and access fileLines2[3] which will throw that exception as there are only 3 items in it. So you'll need to check the second array is big enough before you access it
if (fileLines2.Length > i && fileLines1[i] != fileLines2[i])