It follows the comics to some extent. But there are changes made to adapt it for the big screen and to create a unique cinematic experience.
Avengers: Endgame takes inspiration from the comics but also deviates in several aspects. Some storylines are condensed or modified to fit the movie's runtime and narrative requirements. However, it still retains the core elements and characters from the comic universe.