modify print() to print whether cursor is at last line