Use Option::expect instead of pattern matching in try_append_to_line_by_new_line