First, most African countries got their independence at the time. And taking Nigeria as a case study, civilian rule failed terribly at that time. Because most of those civilians who were elected into government after independence got real greedy and corrupt, so they looted the country and embezzled public funds.
Military government became the better alternative. Many people thought it was the best option because it actually succeeded at first, but in the subsequent years that passed, it started to fail and it became even worse than the former corrupt civilian government.
You know, when a soldier becomes really corrupt and greedy, the consequences are likely to be far worse and calamitous than just a civilian being greedy. And since "...., absolute power corrupts absolutely”, many of the military men who got to the top became extremely very corrupt, violent and tyrannical.
And another thing to observe is the mindset of Africans in general, with regards to the fact that whenever anyone gets to power it becomes very difficult for them to take their leave when their time is up (This must have been due to the long monarchical system that was practiced in Africa before the colonization era). It is very hard for them to leave, especially the very corrupt ones. In fact, it is usually only death or war that take them away from power, if it is observed well.
In Nigeria for instance, and many other African countries, the old guys that have been in power since the post-independence era are the ones that are still there now, because they either try to cling to the office they were elected into, or they bribe their way into another top government position when their time is up. It is only a very microscopic few that do leave power.
So there were many despots and dictators, maybe because military government was successful in some of the non African countries and also it was also successful at first in some of the African countries. This may be why a lot of military coups happened in many African countries. Both the bad, the good, and the power thirsty came through these several coups that occurred and the bad ones got overwhelmed by power so they became tyrannical and ferocious.
Examples are these; Abacha, Idi-Amin, and Mugabe.
These people you mentioned we are one of the topmost dictators that ever step foot in power in african politics and when you look at how they came into power it was during the 1980s that their rule was rampant, the main reason why this rulers came into power at almost the same period of time was because around the 1950s to the early 1980s was around the period where most african countries got their independence , and they got this independence as a result of some strong men who fought the british koma the portuguese and the french for independence if you take a look abacha was one of the people who fought the british to secure nigeria's independence amongst people like nnamdi azikiwe all these people got to rule because they formed part of the political elite who fought the british to secure nigeria's independence in 1960.
So they all got a shot at ruling africa because there was no immediate government left by the british because even the way the british left places like nigeria was chaotic so it was left to the political elite who fought for independence to get into power as at that time practicing military rulership which was adopted around the world people like mohammed Mummer Gaddafi, idi amin and so many other dictatorial ruler all practiced military government so they practised military government because democracy wasn't even function then and they became dictators and military rule was like monarchy and until there was a coup d'tat military leaders never left office.
Another thing was that when the europeans left africa there wasn't a functioning constitution that provided the land mark on rulership that means people could not get to choose rulers because in the 1950s there wasn't political education on things like constitutional rights or even democracy so ignorance was exploited by people who took over power from the british and as a result of this stayed into power for a long time until democracy started taking shape in african countries however this was a dark period the dark age of ignorance among africans we didn't even have proper education enough to know that they were being marginalized and the view that had proper education could not fight this set of military dictators who took time to rule for 20 years some even up to 47 years and this was the reason , this was the three reasons why african dictators came into power at the same pattern