Confused on discard and starter? Do I need to discard

Can someone tell me if I’m maintaining my starter correctly? I get confused with discarding some. I keep a small amount of starter in fridge and when I want to make a loaf I take out and add flour and water. Then I take out the recipe amount and make my bread and put the rest of the starter in fridge. Then next time I take out that starter from fridge and repeat recipe and put leftover in fridge. Should I be discarding BEFORE I make my bread? Did I mess up my starter?