Declare empty lastLine string outside of for loop