At the end of Endgame Captain America was old and on a bench in the main timeline. This does not seem to make sense based upon how the movie explained time travel. When he went back to return the stones he created a new timeline, and he would have been stuck in it if he just stayed. So,  here’s a Theory.

Captain America returned the stones to the past and then stayed in the past with agent Carter. He lives in this timeline and definitely influenced it. This was not the main timeline but he had a whole long lifetime of experiences, and he kept the quantum device the entire time. He knew about Hydra, he knew about the Winter Soldier, he knew about Wakanda, he knew about Thanos and aliens, he knew about the rest of what happened in the world since WW2. And he acted on some of it but much of the specifics changed due to his influence.

Captain America told Howard Stark about the timelines and showed him the quantum device. They met with Hank Pym and analyzed the technology. Years later they discovered a way to send Captain America back to the main timeline we know because he was still tethered through the quantum device. They knew it was a one way trip so he decided to wait. He lived with Carter and had kids, and lived a great life. Once she passed away he decided to return to his main timeline, so that his friends could know what had happened.

It is of course a leap to say that they found a way to send Captain America back to his main timeline. Though Tony Stark invented time travel in just a little while. I wonder what his father and Pym could have done with the Quantum device, the space stone and decades. And Captain America would also know about the Sorcerer Supreme, who has the Eye of Agamotto AKA the time stone.

The weird thing about the idea that Steve interacted with the world in the past is that there was still another Captain America. So would Steve go and find himself in the ice? This timeline would be very strange.