Is he trying to lick and bite near the area you put the medication on?? Or just general body?? Also, was this preventative, or were their fleas to start??
It is very possible their is an allergic reaction to the oil in the product. This is fairly common with cats and Frontline. Usually they get itchy and a bald spot where the product was placed. I know Frontline has a non-oil formation for cats because of this issue. Its a spray so its a pain to apply, but it does work if the issue is an allergy. Other products may have similar sprays for cats. (for some reason cats tend to be more sensitive to the oils than dogs).
Another thing to consider is making sure the dosage was correct. Often they are weight dosed, even for cats, which also are kitten vs. adult cat dosed. If the dosage was too much, that could have caused irritation.
Lastly, if the medication was a "cheap" product like Hertz and similar...these products often have other ingredients that tend to be irritants. Also, they often aren't that effective (from what I've seen from clients who have tried them).
If its an allergy and the kitty is healthy, the itching should subside within a day (given he doesn't cause a sore from the biting and scratching). If that's the case and it stops on its own, I would try a different product next time, likely a non oil based. (FYI...DONT do the collars...they are a waste of money, don't work, and make a mess of your things it touches).
If the itching continues longer than a day, call your vet. The kitty may need an antihistamine or cortisone. Do NOT give ANY antihistamine without getting the dose from a vet and be available to watch for any negative reactions since all antihistamines have sedative effects. Or your vet may want to see the kitty for an exam to see if something else might be going on.
Best of luck.
Mine did that after frontline I think she was allergic to it ,but she did stop after a little while ..