These countries are indebted because so much of the money they were given did not go to the projects they were intended for.
They were also often for projects that were vanity projects, not ones that were directly useful. In the early 1980s I worked, briefly, for a big American engineering company in the division that built things like aluminium plants, and car factories in countries that really needed roads, power stations and water mains. The company knew they were vanity products for the ruling elite, who both took money from the projects themselves and took more in bribes from the contractors who paid to get the jobs.
At one point my heart bled as much as anyone elses for these poor benighted country, but as I have seen so many other countries with the same backgrounds in other parts of the world build successful economies, my blood as gradually dried up. I now think channelling vast amounts of aid to these countries actually makes the situation worse not better.
I am all for charities, like Practical Action, taking small scale technology to farmers in their villages: new seeds, better tools, wells and sewing machines, but above that level I now believe that the sooner all cash aid stops, the better.