Can an Automator workflow generate an Application?
So from the edits to my post, I was on the right track.  But I forgot that the final script needs to have quotes around the content being passed in!  This is the code snippet that ultimately worked:
set sms_address to &quot;sms_address&quot;
set sms_body to &quot;sms_body&quot;
set filename to &quot;filename&quot;
set savePath to (path to desktop as text) &amp; filename &amp; &quot;.scpt&quot;

set code to &quot;osacompile -e '
tell application \&quot;Messages\&quot; 
    set imessageservice to 1st service whose service type = iMessage 
    set iMessageBuddy to buddy \&quot;sms_address\&quot; of imessageservice 
    send \&quot;sms_body\&quot; to iMessageBuddy
end tell' -o &quot; &amp; quoted form of POSIX path of savePath

do shell script code

So I was on the right path all along, just needed to excape those double quotes.