If you are a beginner there're lots of things you have to learn. Firstly, try to read some
poker books, articles, and watch videos for newbie poker players. After the time you could say you got at least the poker basics right, try to play on the tables.
With AA, it's never ever a mistake to go all-in preflop. Yes, sometimes you can get burned by someone holding other hand, but AA is the most powerful hand in poker, and you will win with it most of time. Your only mistake is making open-push with it. Everyone else can clealy see now that you got AA. And it's not a good thing, trust me. Poker is a game of fooling your opponents, not a game of saying "hey guyz I got AA c'mon pay me". Make standard raise (most of time it's about 3 big blinds) and wait for some action. You need to get value from your hand and decrease the number of players you are going to play postflop with. Play postflop with your aces if you have to. Postflop game is another story, it's more complicated than preflop game. After some time, you probly will figure out how to play postflop properly. If someone re-raises you preflop, always try to raise more. As I said above, it's never a mistake just to go all-in with aces, and you should do it if your opponent(-s) doesn't mind going all-in as well.
And a few words about badbeats.
poker game is full of badbeats. Remember that's poker and crap happens. If someone wins with a hand like 54o when you get aces, then well I know the feeling, it sucks. But depending on math the strongest poker hand wins most of time. For example, KK vs. AA have only ≈17% to be a winner preflop. This means you win 83 out of 100 times when it happens. Not 100%! If you lose with aces, that's just poker, no hand has 100% chance to win. Just keep grinding, another time you'll make it.