Implemented the setLineText helper function