Multiple issues with what you are trying to do. First, the command is used like this:
quest::addloot(itemid,charges); #Adds x-charges of an item to the NPC's loot
As seen on this page from the Wiki:
http://www.eqemulator.net/wiki/wikka...=QuestTutorial
The $npc-> pointers are only used in the quest objects from this page:
http://www.eqemulator.net/wiki/wikka...a=QuestObjects
They are categorized so you can know what type of pointers work with each command. The $npc one works with the NPC or Mob section commands. The $client works with the Client or Mob section. The rest are all in their own sections and don't work with NPC or Client.
Another problem is that quests don't load for an NPC unless it is in the database, and using #spawn doesn't put them into the database until you use "#npcspawn create" on them or something. Once you have created the spawn, you will need to do a repop and maybe even a zone restart (forget if one is required for sure or not offhand) before scripts will load.
Also, many commands have trouble working directly from EVENT_SPAWN due to the NPC being in the middle of the process of being created at that time. I think more work now than what used to work from that event, but if you can't get them to work from EVENT_SPAWN, the easiest work-around is to set a 5 second timer and use EVENT_TIMER to do your script commands.