Added functionality to write at the cursor position, and move to next
line when screen end is reached.