God made the earth for a purpose.
He made it to be inhabited.
Isaiah 45:18 For thus saith the LORD that created the heavens; God himself that formed the earth and made it; he hath established it, he created it not in vain, he formed it to be inhabited: I am the LORD; and there is none else.
He intends to fill it with his glory in the form of men and women raised to the divine nature and made equal unto the angels in whom and with whom God will live forever.
Numbers 14:21 But as truly as I live, all the earth shall be filled with the glory of the LORD.
He did not make man as a robot.
He gave mankind freewill so that they can choose whether they want to be part of his purpose or not.
Deuteronomy 30:19 I call heaven and earth to record this day against you, that I have set before you life and death, blessing and cursing: therefore choose life, that both thou and thy seed may live:
Those who want to be part of his purpose must live their lives by his commandments.
Ecclesiastes 12:13 Let us hear the conclusion of the whole matter: Fear God, and keep his commandments: for this is the whole duty of man.
Those who do not want to be part of his purpose can live their lives to suit themselves.
Sin is disobeying the commandments of God.
Adam and Eve disobeyed God in eating the fruit of the tree of the knowledge of good and evil.
In doing so they brought sin and death into the world.
Death is the punishment for all sin.
Ezekiel 18:4 Behold, all souls are mine; as the soul of the father, so also the soul of the son is mine: the soul that sinneth, it shall die.
Romans 6:23 For the wages of sin is death…
Because they ate the fruit of the tree of the knowledge of good and evil their offspring are born with a propensity to sin.
The result is that all sin and come under the sentence of death.
Between Adam and Noah mankind exercised their freewill to fill the earth with violence.
Genesis 6:11 The earth also was corrupt before God, and the earth was filled with violence… 13 And God said unto Noah, The end of all flesh is come before me; for the earth is filled with violence through them; and, behold, I will destroy them with the earth.
Because of this God determined to destroy them; which he did with the flood.
Noah and his family were saved and God’s purpose continued.
Out of each generation those who recognise their own sin and try to live by God’s commandments become part of his purpose.
In the last day God will raise them to life again and give them the divine nature.
To cover their sins, God promised a redeemer – a second Adam – who would sacrifice his perfect life to make atonement for them.
God chose Abraham who believed and obeyed him as the progenitor of a promised seed in whom all nations of the earth will be blessed.
He promised Abraham and his seed an eternal inheritance in the earth.
He promised Abraham that his offspring would become a great nation some 400 years later after a sojourn in Egypt.
The delay was partly because the wickedness of the Canaanites was not yet full.
Genesis 15:16 But in the fourth generation they shall come hither again: for the iniquity of the Amorites is not yet full.
Abraham’s grandson Jacob (whom God renamed Israel) went into Egypt with his family and there multiplied into a nation.
God brought the nation out of Israel by the hand of Moses and after 40 years wandering in the wilderness brought them into the promised land.
The promised land (Canaan) was inhabited by people who were idolaters who had forsaken the true God and made their own gods.
Idolatrous practices included the sacrifice of children and gross immorality.
God foresaw that if Israel settled in the land amongst these people the nation would be drawn into idolatry.
He therefore commanded them to utterly destroy those nations and their idols so that Israel would not be corrupted by them.
Exodus 23:31 And I will set thy bounds from the Red sea even unto the sea of the Philistines, and from the desert unto the river: for I will deliver the inhabitants of the land into your hand; and thou shalt drive them out before thee. 32 Thou shalt make no covenant with them, nor with their gods. 33 They shall not dwell in thy land, lest they make thee sin against me: for if thou serve their gods, it will surely be a snare unto thee.
Israel failed to do as God commanded and the nation turned to idolatry.
As a consequence, Israel was first split into two nations and then taken into captivity and removed from the land.
In the process of falling away from God, Israel blackmailed Pontius Pilate into putting the promised redeemer, Jesus Christ, to death; not withstanding that this was prophesied in the word of God given to Israel by the prophets.
Israel are not cast off forever. In the fulness of time Jesus Christ will return from heaven to save the nation and restore the kingdom of Israel as the kingdom of God upon earth.
Luke 21:24 And they shall fall by the edge of the sword, and shall be led away captive into all nations: and Jerusalem shall be trodden down of the Gentiles, until the times of the Gentiles be fulfilled.
Jesus Christ is a descendant of David through Mary and will sit upon his throne ruling the whole earth.
Luke 1:32 He shall be great, and shall be called the Son of the Highest: and the Lord God shall give unto him the throne of his father David: 33 And he shall reign over the house of Jacob for ever; and of his kingdom there shall be no end.
From this we see that God found it necessary to eradicate people whose lives were given over to doing evil.
Following resurrection and judgment at the beginning and end of Christ’s millennial reign over the earth, the responsible wicked will be destroyed and the faithful given eternal life in the kingdom of God on earth.
God being the creator and sustainer of all mankind is free to do what he thinks best to bring about the completion of his purpose for the benefit of those who believe in him and try to live by his precepts.
God is not willing that any should perish and takes no pleasure in the death of the wicked but does whatever is necessary to save those who choose to be part of his purpose.
2 Peter 3:9 The Lord is not slack concerning his promise, as some men count slackness; but is longsuffering to us-ward, not willing that any should perish, but that all should come to repentance.
Ezekiel 33:11 Say unto them, As I live, saith the Lord GOD, I have no pleasure in the death of the wicked; but that the wicked turn from his way and live: turn ye, turn ye from your evil ways; for why will ye die, O house of Israel?
We have then a choice:
To obey God and live; or to do our own thing and die.
May I suggest that you read ‘Your Share in God's Promises’ here:
https://www.thisisyourbible.com/library/show/181
And ‘The Kingdom of God on Earth’ here:
https://www.thisisyourbible.com/library/show/170
I hope you find this helpful.
God bless,
Glenn