how to add lines to a vim register without overwriting it

Solution 1:

If you want to append to a named register use it's corresponding upper case character. i.e. In your example:

"ayy
"Ayy
"ap

Solution 2:

Just to expand on MarkB's response, did you know you can also use markers to select a block of text for your yank?

Go to the first line of the block you want to yank and enter the mark command after selecting a letter as the marker, e.g.

ma  (entered in command mode, i.e. no colon)

then go to the bottom of the block you want to yank and enter the command:

:'a,.ya A

this command means take the block of text from the line containing my marker called a up to the current line and yank it into buffer a. Same rules as MarkB mentioned apply, use lowercase buffer name to overwrite the buffer. Use uppercase buffer name to append to the buffer. So in this case this will append to the contents of buffer a.

N.B. The 'a' used for your marker has nothing to do with the 'a' used to select your register. (AFAIK but YMMV)

BTW 'a (apostrophe a) refers to the line containing the marker a. `a (backquote a) refers to the character under the cursor when you entered ma.

d`a (also entered in command mode)

is useful because it will delete the text between the character marked with marker a up to the character just before the character where you cursor is currently located.