As others have said, the general answer is to use dd "kP. I would like to add that you can use: g, so if you want to replace all the lines that match 'foo' with the contents of register k, you can do:
: g / foo / normal dd "kP
Note that using p instead of P will cause some problems if the first line of your buffer matches the pattern.
source share