Refactor in to a few functions. Keep lines for printing.
Separate checking logic in to a checker type
Print the contents of the line that is in error.