It might be having problems recalculating the new value when setting the global itself. I tested the script below in sub EVENT_SAY and it works fine. If it doesn't work in sub EVENT_KILLED_MERIT then there is something not working with that event. And as joligario said, make sure you have qglobals set to 1 on this NPC in the database.
Code:
sub EVENT_KILLED_MERIT {
if (($qglobals{mmed}>=3) && ($qglobals{mmed}<=6)){
$new = $qglobals{mmed}+1;
quest::setglobal("mmed", $new, 5, "F");
}
}