Discipline is an Act of Love
My child, don't reject the Lord's discipline, and don't be upset when he corrects you. For the Lord corrects those he loves, just as a father corrects a child in whom he delights. Proverbs 3:11-12
As children any time we did something wrong we would be disciplined for it. Our parents did this because they loved us and only wanted the best for us. They did their best to make sure when we were doing something wrong they were quick to correct us. In that moment it was like the worst thing to be scolded, and maybe even hear "this is for your own good." What about right before getting a spanking we would here, "this is going to hurt me more than it hurts you." The Bible does say train up a child in the way they should go.
The same applies when our Heavenly Father corrects us. He is doing it out of love for us. He wants us to be the best version of ourselves and of course that requires discipline. We tend to get off track and he wants us to stay on the narrow path. He wants us to learn from our mistakes so we will not repeat them over and over. "As we learn from our mistakes we will advance in making progress."(LHM)
Our Father is training us to be obedient and to follow His rules. He is teaching us to change our behavior and be an example for others. Just as a big brother or sister is a role model we have younger brothers and sisters who will follow in our footsteps. So don't get mad when God disciplines you. We all need to be corrected and God does it in such a loving way.