The excretory system filters and removes excess and unnecessary materials from the body. Filtering and removing waste products regulates the body's internal chemical balance. If waste didn't get filtered out, it would damage our bodies.
When you want to get rid of something in your house, say a box of stale pizza, you need to break it down into its components. The old pizza gets thrown into the compost because it's organic waste. The cardboard gets sorted into the recycling because it's reusable.
When your body wants to get rid of something, it goes through a very similar process. When we consume food and drink, our body takes the nutrition it needs from it. There are often things we consume that our body doesn't need, which gets filtered out by the kidneys. Similar to our example of stale pizza, the waste gets collected, sorted, and expelled from the body as either a liquid or a solid.