The rewrite anime is a "new" route which is basically an amalgamation of all the routes. It grabs events from all routes that are in the VN, plus some new content with Kagari (most probably inspired by the Harvest Festa fandisc, where Kagari has a similar personality).
Spoiler for Moon and Terra (i.e. second season)
As for the ending, all of the routes that branch off from the common route are "bad" endings. In some, humanity is either wiped out or reduced to a state where it has no future. In others, even if there are no obvious bad effects, it is hinted that humanity has a few dozen years of survival, maximum. The ending of anime is closest to Shizuru's end, where possessed Akane instruments Salvation through Kagari, but a few humans are just barely able to survive. But they probably die off, unable to rebuild human civilization.
As for Terra:
It is in Terra's route where humanity actually gains a future, thanks to the sacrifice of one random guy, which is central theme of the route (and the whole VN by extension).