What is the human ego and what is its purpose?
In short, human ego is identity - the sum total of who you think you are.
It has no purpose. We acquire it in early childhood through societal programming and language, when we are still too young to understand what’s going on. Kinda like training a young puppy. Hence sometimes it’s called “conditioning”. It’s basically like a mental decease - a parasite of the brain which is passed from one generation to another, because it wants to survive. All of it happens unconsciously. Parents unknowinfly try to pass their egos to children when they induce ideas of morality, goodness, appropriateness, etc. into them. The other side of these ideas which invariably presents is evil, badness, guilt and shame. One cannot be induced without the other.
So it’s like a huge pool of ideas which we all share, because we all communicate about them, pass to our children, reinforce through behavior etc. None of these ideas are true, but they give rise to a lot of suppressed emotion and trauma, which is why the process of spiritual awakening is very emotional, and expressing emotion can feel like a release.
The very few people who broke free from this mess are called Buddhas or Muktas in ancient spiritual traditions. They are free from their own mind and thus from all human suffering. There’s nothing magical about them - they just don’t believe the things you do, and they allowed themselves to go through the emotional pain of letting it all go. You can also say these people accepted death so they cannot be bothered by anything anymore. Other than that, they are ordinary people. They usually live lives spontaneously, can literally do nothing at all if they want to, and see life as a game rather than a struggle.