What did the League of Nations do wrong as compared to the UN?
The fatal flaw in the Covenant of the League of Nations was that its terms were only enforceable against members of the League, and therefore depended to some extent on voluntary cooperation. A second factor was the reluctance of members of the League to enforce its provisions.
Article 16 of the Covenant stated:
Should any Member of the League resort to war in disregard of its covenants under Articles 12, 13 or 15, it shall ipso facto be deemed to have committed an act of war against all other Members of the League, which hereby undertake immediately to subject it to the severance of all trade or financial relations, the prohibition of all intercourse between their nationals and the nationals of the covenant-breaking State, and the prevention of all financial, commercial or personal intercourse between the nationals of the covenant-breaking State and the nationals of any other State, whether a Member of the League or not.
It shall be the duty of the Council in such case to recommend to the several Governments concerned what effective military, naval or air force the Members of the League shall severally contribute to the armed forces to be used to protect the covenants of the League.
The Members of the League agree, further, that they will mutually support one another in the financial and economic measures which are taken under this Article, in order to minimise the loss and inconvenience resulting from the above measures, and that they will mutually support one another in resisting any special measures aimed at one of their number by the covenant-breaking State, and that they will take the necessary steps to afford passage through their territory to the forces of any of the Members of the League which are co-operating to protect the covenants of the League.
When Germany, Italy, and Japan took actions which were obviously violations of the League covenants, they simply resigned from the League. At that point, they were no longer "members" of the League and arguably not subject to Article 16. Assuming for the sake of argument, however, that the League could still act to stop aggression, France and Britain were reluctant to proceed against Germany, but rather chose to appease Hitler.
As with any written understanding, the Covenant of the League was only as powerful as the will of its members to enforce it. Lacking that will, the Covenant was useless.
The League of Nations did not set up a large number of international bodies like the United Nations has. But that is not the main reason why the League was less successful than the UN. The main reason is that the League was simply created at the wrong time in history.
One thing that the UN has done that has been important is to create many international organizations. These are things like UNICEF or the World Health Organization. These entities are not aimed at peacekeeping through collective security. Instead, they are aimed at getting international cooperation in improving people's quality of life. Some scholars of international relations believe that participating in these sorts of organizations creates better relations between countries and reduces conflict. The League did not create such things.
But the main problem for the League is that it was created before the world was really ready for it. There were too many large powers that were still interested in conquest and in completely overturning the status quo. The UN itself has not been able to prevent wars. The League was even less able to because it was created at a time when there were still major powers (Germany, Japan, Italy) that still wanted to wage war. This is much less true today and in much of the time since the UN has been in existence.