Turning a list into one line used to be a job for a loop or a sed trick.
printf '%s\n' alpha beta gamma | paste -sd, -
-s pastes all lines of one file into a single line, -d, sets the delimiter, and the final - means standard input. The result is alpha,beta,gamma. Without -s, paste puts several files side by side as columns. The delimiter list is used in turn, so -d',\n' alternates comma and newline.
Further reading: paste manual page