From Chabad.org: The Jewish people rejected the pleas of Joshua and Caleb, and decided to stone them. G‑d intervened, His glory appearing over the Tabernacle. G‑d informs Moshe of His decision to instantaneously wipe out the Israelites in a massive plague due to their persistent lack of faith. Moshe successfully invoked G‑d’s mercy and pointed out that this mass execution will cause a mammoth desecration of G‑d’s name. “People will assume that G‑d lacked the power to defeat the Canaanites in battle, so He instead slaughtered His people,” Moses argued. Although G‑d agreed not to immediately wipe out the Israelites, that generation would not enter the Land. G‑d instructs the Jews to reverse course, and to head back to the desert.
So Moshe and G-d take turns giving up on the Israelites. This time Moshe saves the day with his quick thinking arguments. It’s always amazing when Moshe is able to hold sway with G-d, appeasing Him with logic that He undoubtedly already knew. It must be that there was a benefit to 1) manually going through the arguments, and 2) recording those arguments for us to learn from. It could be similar to the concept of Vidui, or verbally admitting one’s sins. There’s a benefit to arguing for what you believe in!