Can you state the requirements in natural language?
Perhaps you want to transpose a column of unknown length to a row whose elements are separated by commas, and a fixed number of additional elements are to be added at the row start.
Code:
colemar@deb:~$ cat inputfile
one
two
three
four
five
colemar@deb:~$ echo red,blue,white,$(tr '\n' ',' < inputfile)
red,blue,white,one,two,three,four,five,