National Unity and collective defense from foreign* I.E. French influence and invasion.
Article 6 of the first Peace of Paris (1814) recognizes that the States of Germany would be independent and form a federative bond.
The Confederation was replacing the governing framework of the former HRE, while its often quipped that the Empire/Emperor had no power, that's simply not true. The Empire had no formal constitution but a thousand years of legal precedent and rights & responsibilities that protected the various estates. An Imperial Army of the HRE that could be only deployed by the vote of the Imperial Diet. Imperial "circles" that divided the empire for tax collection and military muster. Court systems that ruled on legal and noble issues.
But that's a thousand years of medieval and modern laws clumped together that while the Napoleonic wars eventually destroyed the Empire, it cleared the slate of all those laws, allowed the micro states, long under imperial protection, to be absorbed by larger states and a new, simplified governing framework to be established.
You can read the Constitution of the German Confederation here The text is german but your browser should translate it easily.
You can see how the constitution gives powers to form a federal army for the collective defense, appoint ambassadors on behalf of the GC, And pass laws in a federal assembly.
The German Confederation proved its worth during the "1840 Rhine Crisis" when the French Prime minister and government attempted to claim the Rhineland again and put their border to the River Rhine.
The Confederation pushed back against French aggression, rallied troops, had federal forts manned by troops of the various states (mainly Prussian and Austrians) and constructed more fortifications.
But the Power struggles between Prussia and Austria were already baked into the Confederation in 1815, but the Confederation gave Germany the protection and structure needed for later unification.