getnextline A function that reads one line at a time from standard input and files each time it is called.