It worked for me (2017.2.2 on Windows):

C:\InterSystems\Ens172\bin>CSESSION ENS172 < c:\s\try.script

Node: TIN, Instance: ENS172

USER>zr

USER> ; Test routine created by try.script file

USER> w !,"This is written by INT routine ",$t(+0)

USER> w !," which is created from a script injected to csession."

USER>zs MyBootRoutine

USER>d ^MyBootRoutine

This is written by INT routine MyBootRoutine
 which is created from a script injected to csession.
USER>; Clean up

USER>zr  zs MyBootRoutine

USER>h

C:\InterSystems\Ens172\bin>

Maybe your indented script lines (the ones to insert into the routine) aren't starting with $C(9)

Make your script create an INT routine and run it. Example try.script below. Your lines of code either begin with the TAB character or with a label followed by TAB.

zr
    ; Test routine created by try.script file
    w !,"This is written by INT routine ",$t(+0)
    w !," which is created from a script injected to csession."
zs MyBootRoutine
d ^MyBootRoutine
; Clean up
zr  zs MyBootRoutine
h

It sounds like you're seeing the same value in the "License Id" column as in the "ID" column. So I guess your Cache was installed with Minimal security and you're not requiring Portal users to supply credentials, right?

It's my experience that when CSP users (e.g. Portal users) have to authenticate, the "License Id" field of their CSP Session record includes the IP address they're connecting from, as well as the username they logged in with. This can be useful in working out who is using all the sessions.