Basically, any AD carry (like kogmaw) will have a hard time vs a burst dmg mage in mid, so i suggest that you dont go mid with kog, however, there is ways to defeat an annie as kogmaw in mid.
Number 1 thing to note with annie. is her when her stun is upp. when you hear her giggle, and a white circle is surrounding her, then stay back. this means her next spell will stun you. you can not let that stun hit you. ever. so just stay back when she has the stun upp. eventually she will use it.
Number 2 as long as you are not getting zoned out. you should be hitting level 6 at the same time. i suggest building Tear of the goddes. making you able to constantly harras her with ur ulti. if you can keep hitting her with ulti, eventually she wont be that agressive.
Number 3 Bio FTW. Use the range enchance spell. Bio-arcane barrage is a extremly powrefull spell. players just tend not to see it.
The way i build Kog maw is a bit special. i go AP + Attack Speed. making Bio Arcane Barrage deadly. as it deal percentage dmg, (meaning, ignores all armor and mr) pluss giving you extra range. Using this to harras annie from level 1-5 or just use it to get minion kills from a far is an effective way not to get zoned. and as i said. once you hit level 6, be sure to harras her with Ulti.
kog maw build i use:
Sorc Shoes.
Tear of the goddes.
Nashors Tooth.
Wits End.
Tear of the goddes into AA staff.
Deathcap
Voidstaff.
You can also choose to go for berserker greaves instead of sorc shoes if you want, but i find the sorc shoes more effective early game.
Its important to spec Bio Arcane, as this spell becomes SICK once u get enough attackspeed + ability power...
But once again, i dont reccomending going against a AP burst mage, with kogmaw, or any other non-burst mage champ.