>> “Its said in the Bible that God knows the beginning from the end. Thats a basic teaching in Christianity.” <<
.
Not exactly.
God declared the end from the beginning.
.
He has declared it in terms of what his active will is, while at the same time God has allowed a limited amount of free will with people, and in that he “knows” it and hasn’t violated the elements of free will He has given to you.
Thus no one thwarts God’s plans for the future, but you personally have a part in acting too - from your own free will - and God “knows” that even before you do.
We should also note that God has declared SOME of it, not all of it, as we are given a very limited revelation of it.
You can say that God has declared some of it, and we know it from his revealed will, he may have declared other parts of it where we don’t know (like in the counsels of heaven) and then there will be other parts that he has not declared but that he knows. And along with all that, he also knows the beginning from the end in all other situations, as in our free will choice that he has given us.