I think they probably knew the beginning and the end on the first season, and settled on other things like time travel, Jacob and the monster in the second, which is where they started planting the seeds of what's happened in these last two seasons.