Macro freezes at Execute Shell Script

My first thought was that I would use a temporary file rather than push the use of variables so hard. This also seems to be the conclusion of this post from Peter, from 2015:
Maximum size of a Keyboard Maestro variable string?