2024 - At the end of Avengers: Endgame, within the same, primary, Earth-616 universe, Steve goes back in time to…
1949 - where he reunites with Peggy. This is the final scene of Avengers: Endgame, where Steve and Peggy slow dance in her home.
1949 - ???? - Steve and Peggy get married (we see Old Steve in 2024 with a wedding ring on) and then have a baby (shown in the first Avengers: Doomsday teaser).
1950s?/1960s? - At some point after marrying Peggy and having a baby with her, Steve is recruited by a member of the TVA (from the Loki series and Deadpool & Wolverine) to join the fight against Doom. Because the Doom threat somehow affects Steve and his family as well, Steve agrees to join the fight, and the TVA member then takes Steve to either…
1960s - Earth-828 (the universe featured in the Fantastic Four).
2028/2029 - Earth-616 (the year Avengers: Doomsday takes place).
… or potentially both, where, in one of them, Steve meets up with Thor & co (whom we know start out in 2028/2029 Earth-616 but eventually venture to 1960s Earth-828 at one point).
Either way, the events of both Avengers: Doomsday and Avengers: Secret Wars then play out, Steve presumably survives, and somehow makes it back to Earth-616 (likely in the 1950s/1960s, when he left to join the fight against Doom), where he grows old, presumably with Peggy and their kid(s).
2024 - Then, ultimately, as an old man, Steve shows up on the park bench outside of the upstate Avengers headquarters, post Avengers: Endgame, and gives Sam his shield.
To get super technical, Steve going back in time originally (at the end of Endgame) would have created a new branch of Earth-616, stemming from 1949 (the year in which he returned). So, at some point after Doomsday / Secret Wars, assuming Steve rejoins Peggy/their kid(s) in that branch, yes, he's going to have to jump over the primary Earth-616 branch to give Sam his shield in 2024.