Evil did not exist before the creation. There was only God.
Evil, and the need for Hell, was a natural byproduct of the creation. Because God knew that man would eventually sin, due to the existence of evil, (which had to exist in order for there to be a choice), He purposed a plan in which man could be atoned for. This would require the death of His own son. Only a loving God would do this.
Because God wanted to create humans and angels with the free will to accept to love Him, or to deny Him, this self-limitation of God's sovereignty allowed for sin to be committed by free will acts of these agents. Because God is holy, and cannot abide in sin, He had to provide for a means of separating Himself from this sin. That in effect is what Hell is, the eternal separation from God.
God could have created a world without evil, but any creation which does not allow evil to exist, results in destroying man's ability to choose between good from evil, or for that matter, to even know the difference. We could never love God in any real sense of the word, for we would not know what love is. How can we know love, if we have never experienced the absense of it? Any other solution is a sterile world, with God controlling everything, even our ability to choose to love Him. God doesn't want that. That was Satan's proposal.