If you are using Windows you can run your emacs -nw within a Cygwin Mintty. Then you can use the mouse to yank/paste from/in Emacs. In default configuration simply use your mouse together with Shift key (<S-mouse-1> to yank, <S-mouse-2> button to paste).
You can change the modifier key via Mintty "Options/Mouse/Modifier for overriding default".
Select the rectangle (e.g. use C-x SPC).
Use this command (M-x foo) to copy the variables to the kill-ring, as the string "a_to_b, b_to_c, d_to_e, e_to_f, g_to_h":
(defun foo (beg end)
(let ((vars (mapconcat #'identity
(extract-rectangle (region-beginning) (region-end))