so, the first arc of the movie they kill thanos (or beat him, i dont know), but a more powerful thanos appears at the end? Where this thanos cames from?
Apparently as the Avengers meddle with the past and steal the stones, Nebula or Gamora (evil, from the past) notices that the stones are disappearing and them and Thanos put it together that Earth is gathering them. Keep in mind that at this point (as far back as NYC battle) Thanos was already looking for them.
So basically Thanos finds out that the Avengers are time-travelling to get the stones, and so he heads to Earth to get them (right after the Avengers have them all).
Hmm...and if evil past Gamora is in this one...that gives a PERFECT opportunity to re-introduce her (kind of like Spock in Star Trek) where she doesn't remember anything and has to re-forge her relationships.