Docker echo cat or printf multiline script into the docker file heredoc

I use docker beta and I am unable to write a bunch of script into a file inside the container while building.

Build fails.

The script has a bunch of brakcets
Locus = BIAS_utils.Locus(line[0])