If Krishna, God, the Supreme Person allows good and evil to exist on all the planets of the material cosmos, it is to allow living beings to learn to Obey him, and to act in a just way for the well-being of all by avoiding to make others suffer and to know that any act generates effects with various consequences, good or bad, of which each one will have to account and to undergo a sanction at the end of the current life already, and certainly in his next existence.
By creating suffering, God desires that the human being by the suffering felt and generally undergoes during his next existence, he erases the guilty act committed in his past life, becomes aware of the pain that results from doing penance, act of repentance, asks forgiveness for the evil and the suffering he has caused, turns to God, and resolve to never do it again, to hanger better, and never again to make suffer anyone, human beings, animals and plants.
Logos 372
When God inflicts a punishment it is always out of compassion and mercy, in order to save a being from hell.
When God inflicts punishment on a person guilty of malicious, criminal acts, it is to bring him to correct himself, bring him to reason and thus make him aware of his mistakes. These punishments from God are based on the Lord's compassion for the guilty person, in order to save the latter and prevent him from going to hell. But if this guilty being does not want to listen to God by doing what he wants and does not heed the mercy of the Lord, then he will go to hell for a long time.
Any punishment or divine punishment aims to bring the being to repentance, to penance, to radically change his attitude, to become better, to respect and apply the precepts, commandments and counsels of God, and finally, to make it possible to erase the faults committed by the suffering felt. We must suffer for our past misdeeds, it is an irrevocable fact. However, the sufferings of those who serve God with love and devotion are minimized. For example, instead of being stabbed as our fate would have it, we might only get a cut on the finger. Thus are minimized the consequences of the past acts of one who practices devotional service, and who serves the Lord with love and devotion.
Krishna, God, the Supreme Person says: I will protect you from the consequences of your faults.
Don't hurt anyone and love each other with unconditional love, but above all, let us surrender to God, obey Him, do His only will, unite our interests with His, and let us serve Him with love and devotion. Such is the perfection of existence.
The Lord, the Soul of all beings, is serene, peaceful and impartial towards all beings.