Use heredoc for $SOURCE_STR and append with tee

Followup of #454