Routing Script - Help pls

Hi. On 2.8 I used to the the following scripts and it worked fine. Now I’m getting the following error: invalid route configuration. Probly some syntax problem with $gwlocal. Can some help with doing this correct on 2.9.x?

Script1:
get_local_gw

:global gwlocal
:set gwlocal [/ip address get [/ip address find interface=pppoe-local] net

Script2
routes_1

/system script run get_local_gw
/ip route add dst-address=134.63.15.0/24 gateway=$gwlocal distance=10