Is the problem that only the first line read has the Suffix and Prefix lines following it?
Are those two lines correct?
What should the output look like?