You are correct saying that the cooldown is shared for every creature that uses this script.
This is because (for as far as I can tell) cooldown is a global variable.
If you simply want to make a creature cast a spell every x amount of seconds, lets say when he enters combat,
you can use the WorldObject:RegisterEvent method. To demonstrate this:
If for some reason, you want to stop the event from being executed you can use this method: WorldObject:RemoveEvents.
local function onEnterCombat(event, creature)
-- Delay is 10 seconds (10000 ms).
-- The 0 means that the event will be repeated an infinite amount of times.
creature:RegisterEvent(castSomeSpell, 10000, 0);
-- Notice that this function has the same name as registered above.
local function castSomeSpell(eventId, delay, repeats, creature)
-- Do stuff here
RegisterCreatureEvent(npcId, 1, onEnterCombat);
Also as a side note, this is the wrong section for this. You should post this in the support section.