First of all nobody goes directly to heaven or hell for that matter. (There has been a few examples of people who did, but that was an exception.)
The Bible says:
"The hour is coming, in the which all that are in the graves shall hear his voice, And shall come forth; they that have done good, unto the resurrection of life; and they that have done evil, unto the resurrection of damnation." John 5:28, 29. "The wicked is reserved to the day of destruction." "Yet shall he be brought to the grave, and shall remain in the tomb." Job 21:30, 32. .
When Jesus comes, all the rightouss, first those who are in the grave will be rescurrected and caught up yo heaven and after that the living rightouss.
After the 1000 year millennium the new Jerusalem, which is in heaven now will together with God, Jesus and all the rightouss, descend to this earth when the judgement will take place.
Every sinner that is not written in the book of life will if they have denied Jesus to be their master be judged according to their works. That means they will get different kind of punishment depending on how bad they have been. After that fire will come down from heaven (Revelation 20:9.) and the sinners, including the devil and his fallen angels , and they will all burn up completely.
If you want to study this out for yourself, as I do not want you to trust me only because I say so, you can go to: