As mentioned above, Loki is neither alive or dead in Avengers: Endgame. The Loki is see is just a previous version of Loki who hasn't been killed by Thanos yet. But as we all know, time travel can have consequences, especially when it involves the Space Stone.