How Do I Convert Bookmarklet to KM Execute JavaScript?

No. That was due to you NOT posting the script properly.
All scripts should be posted using Code Block.
And in your case most of the code was on one or two lines.
I "beautified" it to make it more readable at this web site:
http://jsbeautifier.org/

Please use both in the future.