First thing I thought about: yank a line to a, yank another line to b; move somewhere into the file; paste from a, move two lines down, paste from b; repeat N times or create a macro for it. Basically it will be macro with two inputs, the contents of the a and b registers.