Or you can show all lines and remove the last newline after exiting the loop.
Or you can insert the first line without a newline and then begin each next line with a newline.
Or you can substract one from num_lines_to_show, run a "for" loop against that count adding a newline after each line and then add the last line after you exit the loop.
Or possibly use any different approach that surely exist.
Bookmarks