I didn't honestly understand what Loki was doing at the end and it's not explained very well.
I thought it was pretty clear. Loki chose to take on the burden of keeping the infinite timelines alive, preventing the Time War, by setting himself up as a god. The details aren't given, but the broad strokes are clear. The new shape of the timelines is a tree, a reference to Yggdrasil the World Tree. Loki has shown himself to be his father's son, even though he was adopted and felt like Thor was the favored child. Loki hasn't just become King of Asgard, he's taken on more responsibility than he ever dreamed of, and done it not for glory, or pleasure, or even out of spite. He's now a new Allfather, in a way even Odin wasn't. He's taken on the burden of the multiverse because he genuinely cares about people, and giving them a chance.
The entire series has been building to this. Loki is burdened with glorious purpose. His variants are more varied than anyone else's. He has potential to be more than he, or anyone else, thought possible. He Who Remains offered Loki a throne at the end of time, ruling over a single timeline. Sylvie accused Loki of being seduced by that throne. Loki then decided to make his own throne, on his own terms. "It's not about what, or where, or how. It's about
Doctor Who who." Loki found friends who he was willing to sacrifice for, and then made that sacrifice not only for them, but for everyone.
Loki, god of mischief, is doing the most punk thing possible: giving everyone free will. He destroyed the system that was keeping a totalitarian regime in place, and replaced it with infinite possibility.