It's not so simple. Even the rival political parties condemned the coup. Edrogan is bad - no question - but so is a military coup. The next few months are going to be key for Edrogan and Turkey.
There is absolutely nothing inherently good about an elected leader, nor anything in inherently bad about a military coup.
Someone elected legally can then work to change laws to prevent giving up power legally. Likewise a military coup against an unjust/illegal government working against the people that intends to partake in fair elections and pass power back as quickly as possible should be seen as nothing less than just. Think of it this way, what would we say if the Army at any point from 1939-45 had held a military coup because they disagreed with their political leaders on the legality or morality of the war they were ordered to undertake, I think most of us would see said coup as absolutely the right thing. Situation and intent are what make things good or bad. Someone who gets elected democratically but has every intention of destroying the democracy is bad, a military coup with every intention of breaking a bad leader and restoring democracy can be good.
Though winning the election legally was always in question with Erdogan, those who found irregularities with his win were branded terrorists and frauds, he took over the paper that had the temerity to question his election and continues to do similar things to anyone who dares say anything about him.
Now it's perfectly possible he was elected legally and the group behind finding evidence to the contrary were lying, but that doesn't make his other actions good. Trying to prosecute people in other countries for saying bad things about him, cracking down on any protests or speech against him in Turkey, shutting down any sources of media that might not support him are all actions of a dictator.
In effect I'd say Erdogan in implementing a coup himself, just because he's the elected official doesn't mean he can't, he's just on the inside and attempting to overthrow the democratic government with his own dictatorship.