Tariel, you shouldn't operate on LL defined in "repeat" condition: The correct loop: repeat for each line LL in TestLog put LL into bLL if last char of bLL <> comma then put comma after bLL -- HERE LL with line 2 of TestLog gets replaced -- by previous LL which was holding line 1 of TestLog end if add item 2 of bLL to tTest end repeat VTB