You could have ******d it, there are good tutorials, this one for example: https://sampforum.blast.hk/showthread.php?tid=95034
Anyways your question was how to record an NPC, well here's how, you could find the filterscript npc_record in any server pack, use it to record the NPC using the commands.
After you're done, you could find the rec output file in the scriptfiles folder.
More info in the link above.