Defending the goal is more than just the goalkeeper's job. It's the job of every single player on the field. In fact, if the ball even gets to the keeper, it means that ten other people failed at what they were supposed to be doing.
You have two purposes when you're defending: you want to stop the other team's attack, and you want to take the ball away from them. Working as a team can help you to achieve both of those goals. But first you need to learn how to be a good defender.