Vim offers line completion (:h compl-whole-line)
Completing whole lines compl-whole-line
i_CTRL-X_CTRL-L
CTRL-X CTRL-L Search backwards for a line that starts with the
same characters as those in the current line before
the cursor. Indent is ignored. The matching line is
inserted in front of the cursor.
The 'complete' option is used to decide which buffers
are searched for a match. Both loaded and unloaded
buffers are used.
CTRL-L or
CTRL-P Search backwards for next matching line. This line
replaces the previous matching line.
CTRL-N Search forward for next matching line. This line
replaces the previous matching line.
CTRL-X CTRL-L After expanding a line you can additionally get the
line next to it by typing CTRL-X CTRL-L again, unless
a double CTRL-X is used. Only works for loaded
buffers.
If you use <C-X><C-L> you can complete lines in any open buffer. So just open the file you want to line complete from in the background and then use <C-X><C-L> to open a menu to select the lines that match start with the same characters as the current one.