Strange.
Did you make sure to copy and paste the entire script correctly (for example, using the copy button in the top right corner)? And did you run the script by using the ‘Replace Templater’ command while being on the note where you pasted the script?