Ah I assumed you have nano installed, my mistake, is your DSM bootstrapped with ipkg ?
If not:
vi /usr/local/etc/rc.d/S99pihole.sh
copy/paste the data, now:
press: escape
press: :
enter: wq!
press: enter
Sorry vi is complicated if you have never used it before.