Parenting Help

I figured out that I have the expectation that my kids will do what I say. I get frustrated and mad when they don’t, and then I yell at them. Unfortunately they are 3 and 4 years old. I don’t want to yell at them anymore. I try so hard. But we keep getting into these power struggles. Yesterday, I didn’t let them get out of the bath until they cleaned up their toys. They were really upset. I didn’t yell but I feel really guilty about it and think I crossed a line. How do I get past this guilt? And then how do I stop yelling? And then how do I be a better parent?