Well this is not a script you should run directly. You need to add it to your scripts folder in my case ~/.nzbget/ppscripts and add it to nzbget as a postprocess script. Then it will run when it is supposed to which is after a download.