Parsing users from a list of commands for email notifications
Critique

First, note that you are misusing tr when you do tr "\n" ", \s".  In tr string1 string2, string1 is supposed to be at least as long as string2, as each character in string1 is translated into the corresponding character in string2.  (If string1 is longer than string2, the last character found in string2 is duplicated until string1 is exhausted.)  Therefore, tr "\n" ", \s" is equivalent to tr "\n" ",", which produces a comma-separated output with no spaces — in contradiction to your sample output.

The dangling ; echo "\n" at the end is awkward.  You're now running two pipelines whose outputs happen to appear one after the other, rather than producing one output stream.  That means that the output merely looks right on screen.  You can't pipe or redirect the whole thing, though, unless you run the two pipelines in a subshell, like ( awk … | tr -d … | tr … ; echo "\n" ).

Suggested solution

awk '{ print $NF }' /tmp/foo | xargs echo will get you mostly there.  By using xargs, you automatically get unquoting behaviour.  (The way xargs handles quoting is not quite the same as the way SQL handles quoting, but in most cases, it's probably close enough.)  The echo command will produce one line of output, ending with a newline.

The only thing remaining is to insert a comma before each space.  For that, I would use | sed -e 's/ /, /g'.  (If you just want commas and no spaces, you can use tr ' ' , instead.)

In summary, do

awk '{ print $NF }' /tmp/foo | xargs echo | sed -e 's/ /, /g'