Consider what is happening when reading the input from the file, namely:
//Get a line
while(fgets(line, LINE_SIZE, input)){ <<-- fgets reads a line _up_ to a LINE_SIZE bytes (and the result will be null terminated)
//Sends the line
write(pipefd[1], line, LINE_SIZE); <<-- Write LINE_SIZE bytes to the pipe
}
So, given a few lines in your file, you may read e.g. 60 bytes with fgets, and then you write 150 bytes to the pipe (meaning 90 bytes of garbage goes there too).
You end up with this:
INPUT:
first line
second line
third line
Pipe data:
first line***second line*** third line ***
Where the ***
symbolizes the garbage data written to the pipe. Once the second process starts reading, depending on the garbage data, it may print whatever it wants.