The perfectly loving God doesn't just love mercy - He also loves justice and righteousness (Jeremiah 9:24). God already made a way for sinners to be forgiven and be redeemed from the curse of sin through the atoning sacrifice of Christ on the cross - and this is how the perfect mercy, perfect justice, and perfect righteousness of God are satisfied (Romans 5:8, 2 Corinthians 5:21, Galatians 3:13-14). People who are condemned to hell are rightly to be so because they rejected God's offer of reconciliation to them.
Try to think of it this way:
There was a just king who had to deal with rebels in his kingdom. But in his mercy, he reached out to them to offer them absolute amnesty, provided that they will swear loyalty to him once again. Not only that their crimes will altogether be forgotten, they will also be granted to have a free access to the king's hall where only the king's friends are allowed to enter. But in their hardened rebellion, they rejected the offer of the king. Isn't it just right for the king to condemn them to death?
Now, we are the ones who have sinned against God, despising His holy and perfect law through our disobedience (Romans 3:9-19, 23; James 2:10). What's even worse is that in our sin, we are running away from Him, stealing His benefits - the natural pleasures and material delights that He created in this world- in order to spend them on our sinful passions. And yet He is the One Who is pursuing us and reaching out to reconcile with us - and this is just one of the beautiful portrayals of grace. But if we adamantly reject His offer of forgiveness, isn't it rightly that we should be condemned?
The Lord Jesus Christ Himself said, "For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish, but have eternal life. For God did not send His Son into the world to condemn the world, but that the world through Him might be saved. He who believes in Him is not condemned. But he who does not believe is condemned already, because he has not believed in the name of the only begotten Son of God" (John 3:16-18, MEV).
As the writer C. S. Lewis puts it, "There are only two kinds of people in the end: those who say to God, 'Thy will be done,' and those to whom God says, in the end, 'Thy will be done.'"
God has set before us both life and death - salvation and condemnation - and He counsels us to choose life (Deuteronomy 30:19). If we reject this counsel, it is perfectly right for us to receive God's perfectly just condemnation. As it is written, "… he who does not believe is condemned already" (John 3:18).