The code is in src/calibre/gui2/dialogs/metadata_bulk.py
However, you can do exactly what you want already, without templates, assuming you are using plain text long text columns. For example, the S&R in this screen capture appends the source column to the destination column, inserting a newline between the two.
If you have an "appending comma" then you haven't unchecked the "Split result" checkbox.