It's not completely clear to me what you want, but in Vim you could do something like this:
:for i in range(line('$')) | call append(i+i, printf("this is line %d:", i+1)) | endfor
The reason I use "
i+i" is that, as lines are inserted into the buffer the line numbers change, and this corrects for that. (If you have a different "starting point" in your range, your correction algorithm will have to be more complicated.)
Or if you want to modify the existing lines in the buffer instead:
:for i in range(1, line('$')) | call setline(i, printf("this is line %2d: %s", i, getline(i))) | endfor
Of course, if you don't want to change the buffer, but just print to the screen, use "echo" instead of "call" and remove the append() / setline() chunks from around the printf().