in reply to Print the output results of matching line horizontally
Have you tried just omitting the \n from each print statement?