How do I print a twig variable inside a JavaScript in a twig file
I'll spare to tell that it's a bad practice to add custom script blocks to templates, and just point out the error(s):

(1) To set the variable content, you have to wrap set into a {% %} block, not {{ }}.

(2) You most probably want the value as JavaScript string, so don't forget to wrap it in " ".

This sums up to

{% set twigVariable = '123456' %}

&lt;script&gt;
  function myFunc() {
    var myJsVar = "{{ twigVariable }}";
  }
&lt;/script&gt;


Which should be working just fine.