Getting Endorsement level 5 is actually really easy. The overarching rule is “don’t be a jerk,” but I’ll share my personal approach.
I personally would leave the other team out of dialogue entirely. People tend to gr or gg in orange chat only when their team won the round and the game. GG or gr to a team you defeated and especially if you steamrolled will be seen as condescending. GG or gr to a team you lost to might cause them to laugh at you.
So, if you win, say “GG guys, and great job” to your own team in blue chat. If you pushed, say “Great push”, if you defended, say “Great hold” in blue chat and if you were getting canned but recovered, say “great recover” in blue chat.
If your team lost, you might piss them off by saying “GG,” so I personally just stay quiet but not quit the game right away. Getting toxic, especially to your own team, will probably lose you endorsements for that game, even if you did a good job actually playing. Saying nothing will never piss anybody off, and if you pulled your weight, they’ll still endorse you.
If your team was so spectacularly awful that you would rather eat crow than endorse them, you can quit immediately after the Defeat sign, or endorse the enemy team’s healers. Keep in mind that assigning endorsements gets you 100 xp, which really adds up as you go through the Battle Pass.
That is literally all you need to do to eventually get Endorsement Level 5. Keep in mind that Endorsement lvl 4 and lvl 5 decay on their own naturally, so Level 5 will stay as long as you play Overwatch and continue getting endorsed. But you can always get it back. Quitting matches, even in Quick Play, will heavily impact endorsement level and you will lose lvl 5 pretty quickly and pretty decisively.
Hope this helped a bit. Have a great day Overwatching.