I know God creates all things for a purpose. God created the earth to be inhabited. Isaiah 45:18. What is the purpose for the new earth if we are not going to inhabit it? Thank you
"But according to His promise we are looking for new heavens and a new earth, in which righteousness dwells" (II Peter 3:13). Peter mentions the purpose of the new heaven and new earth, it is where righteousness dwells. Look at the next verse, II Peter 3:14. It describes what believers of God should be like now in order to inherit this wonderful place, "Therefore, beloved, since you look for these things, be diligent to be found by Him in peace, spotless and blameless." The church is also described in the same manner (Ephesians 5:25-27), as is the New Jerusalem in Revelation. It is implied by what was said before II Peter 3:13 that in the current world unrighteousness dwells in it, but the new heaven and new earth will not have any unrighteousness in it. That would answer your question. But I want to dig a little deeper on how God expounds on this subject.
We see the same idea found in the book of Revelation,
"Then I saw a new heaven and a new earth; for the first heaven and the first earth passed away, and there is no longer any sea. And I saw the holy city, new Jerusalem, coming down out of heaven from God, made ready as a bride adorned for her husband. And I heard a loud voice from the throne, saying, "Behold, the tabernacle of God is among men, and He will dwell among them, and they shall be His people, and God Himself will be among them, and He will wipe away every tear from their eyes; and there will no longer be any death; there will no longer be any mourning, or crying, or pain; the first things have passed away." And He who sits on the throne said, "Behold, I am making all things new." And He said, "Write, for these words are faithful and true." Then He said to me, " It is done. I am the Alpha and the Omega, the beginning and the end. I will give to the one who thirsts from the spring of the water of life without cost. He who overcomes will inherit these things, and I will be his God and he will be My son. But for the cowardly and unbelieving and abominable and murderers and immoral persons and sorcerers and idolaters and all liars, their part will be in the lake that burns with fire and brimstone, which is the second death" (Revelation 21:1-8).
The same idea as in II Peter is presented here. It will be a place where only righteousness dwells. All evil will be cast out into the lake of fire.
Later in Revelation 21, John talks about righteousness dwelling in more detail.
"And he carried me away in the Spirit to a great and high mountain, and showed me the holy city, Jerusalem, coming down out of heaven from God, having the glory of God. Her brilliance was like a very costly stone, as a stone of crystal-clear jasper. It had a great and high wall, with twelve gates, and at the gates twelve angels; and names were written on them, which are the names of the twelve tribes of the sons of Israel. There were three gates on the east and three gates on the north and three gates on the south and three gates on the west. And the wall of the city had twelve foundation stones, and on them were the twelve names of the twelve apostles of the Lamb. The one who spoke with me had a gold measuring rod to measure the city, and its gates and its wall. The city is laid out as a square, and its length is as great as the width; and he measured the city with the rod, fifteen hundred miles; its length and width and height are equal. And he measured its wall, seventy-two yards, according to human measurements, which are also angelic measurements. The material of the wall was jasper; and the city was pure gold, like clear glass. The foundation stones of the city wall were adorned with every kind of precious stone. The first foundation stone was jasper; the second, sapphire; the third, chalcedony; the fourth, emerald; the fifth, sardonyx; the sixth, sardius; the seventh, chrysolite; the eighth, beryl; the ninth, topaz; the tenth, chrysoprase; the eleventh, jacinth; the twelfth, amethyst. And the twelve gates were twelve pearls; each one of the gates was a single pearl. And the street of the city was pure gold, like transparent glass. I saw no temple in it, for the Lord God the Almighty and the Lamb are its temple. And the city has no need of the sun or of the moon to shine on it, for the glory of God has illumined it, and its lamp is the Lamb. The nations will walk by its light, and the kings of the earth will bring their glory into it. In the daytime (for there will be no night there) its gates will never be closed; and they will bring the glory and the honor of the nations into it; and nothing unclean, and no one who practices abomination and lying, shall ever come into it, but only those whose names are written in the Lamb's book of life" (Revelation 21:10-27).
The righteousness mentioned in II Peter and Revelation is about how believers (the righteous), who are pure and spotless, will dwell with God who is pure, righteous, spotless and His light (righteousness and glory) shines forth and no evil (darkness) will be found there because everything is pure and transparent, and no place of darkness or night will be found in that land.
I hope that gives a little more detail and clarity of what it means by the statement "in which righteousness dwells." You are absolutely right, God does not create anything without a purpose for it. Thanks for the question it was a fun one to dig into.