Question: why loki was not in endgame?
Answer: At the beginning of Avengers: Endgame, Loki was definitely dead. He was killed during Avengers: Infinity War by Thanos, who emphatically said the trickster god would not be returning. When, towards the end of the movie, Professor Hulk used the Infinity Gauntlet to bring back those who were snapped, Loki did not return.