Your question is really good and it is indicating that you've got a good intellect. You want to know that if God is exalted in might and He can do everything then what the reason of giving us free will was while He already knew that who would go to hell and who will go to heaven.
In fact, you've little misunderstood it. God is all powerful and as you know everyone who has some power or authority he likes to share and show his powers. Similarly God who is exalted in might and wisdom wanted that there should be some creature that will know him by its own thinking. That is the reason God has given us free will. Moreover, God has also given us the choice to choose the right or wrong way. I meant to say that nobody will go to hell if he wants to go to heaven. Just he needs to perform the acts and deeds which are necessary for going in the heaven.
And another misunderstanding you've created is that we would go to hell after death. No dear! It is not the case, first of all, on the doomsday we would be accountable for our deeds then after reckoning of that who has got the good account he would go to heaven and in the other case, that person will go to hell. And this is what all monotheist religions teach.
We should remember Adam and Eve fell into sins after eating the forbidden fruit. God had told them not to eat it but Eve, who was convinced by the snake (which later we know as Satan), took it and offered it to Adam. As the results:
1.) They both got "kicked" out of Eden (Heaven). The entrance door was locked and guided by two Angels of Lord. Adam and Eve could not enter it back because they listened to the snake, not to God's commands.
2.) Human kinds are born with this basic sin. We cannot go back to Eden because of this sin. But it doesn't mean that we cannot get rid of this sin. And that's what the 10 commandments of God and Jesus, His only Son, are for.
3.) The Snake was also punished by God. He threw it to the deepest darkest hole (Hell) because it led Adam and Eve to the wrong path.
We need to remember God's characteristics as well. God is LOVE. He loves all of us, His creation. Although we had disappointed Him at first place, He still gave us guidance to go back to Eden. The biggest proof of His love is Jesus. Those who believe in and follow Him are those who want to apologize and join Him in glorious Heaven. Jesus said "I am the only true path. No one can go to my Father without Me." If we distrust what He said, we already refuse to go to Heaven.
God indeed is all knowing but God is jealous, too. He doesn't want us to worship/listen to any other god except Him. We ask "God, why you let us fall into sins and go to Hell?" then God will answer "I made you and I love you, but why didn't you listen to me?" Even as human, we will become sad if someone we loves never listens to us.
If we listen to God, we will join Him in Heaven. If we listen to the snake, we will join it in Hell
I would answer your question with a question: Should God then create only people who were going to heaven?
God gives the bible to the whole world, but the whole world is not going to heaven. Its a matter of choice. Whether I choose to follow or not is not up to God. That's a matter of my own willingness.
If god is all powerful and all knowing we cannot have free will by virtue of the simple and perfectly logical fact that this entity (god) creates everything with complete and absolute knowledge of what has been, what is and what will be. When an all knowing entity (just presuming for a moment that it is even possible for such a being to exist) creates anything, that entity knows everything that will transpire between the creation and the destruction (birth & death) of its' creation. That said, god created Hitler, Jeffery Dahmer and George W. Bush with perfect knowledge of what would happen. Free will can only exist in the absence of an all knowing creator. There is NO other explanation.
The devil is a coping mechanism created by the inventors of monotheism to childishly deal with the manifold problems inherent in the concept(s) of monotheistic religious myth. If this god knows everything, then it knows EVERYTHING! It cannot "choose" not to know! None of the defined rules of the universe function within such illogical and insane premises.
This all knowing entity supposedly created "Adam & Eve" and is then surprised that they ate the forbidden fruit. How is it possible to surprise the all knowing? How is it possible to disappoint the all knowing?
This is all ludicrous. If you believe in a talking snake you probably believe that the Earth is flat and universe is geocentric and there's nothing I can do to help you.
I agree with the response above me. By definition if God is all knowing then He must know what will happen in everyone's life and the choices that they make and ultimately whether they would choose Jesus or Hell (BTW, what about all of those people before Jesus, Moses, and Abraham? Do all of those people automatically go to Hell because they have not accepted Jesus, or do they all go to Heaven because they were not given the chance to accept Him. Either way it seems unfair). So it seems that, logically, God's all knowing nature means that by definition there can not exist Free Will.