When I pass a plain string to a function that returns single lines from that string and advances it to the next line, the function does not advance the string but overwrites