write get-line function