If we threw away less food, we wouldn’t need as much as we do now, which means, we could leave some of it in the countries we get it from. In that case, these countries won’t suffer from food shortage. We even could exchange these different foods with other countries that (also) need it, so they will have access to all kinds of food.
Another solution is to produce less food. First, the people of the countries where our food comes from, won’t have to work as long and hard as before. Second, transporting and packing food costs money, which now is saved. It can be used for other goals, for example we could use it for paying those poor people instead. And besides, with that money, we could improve the circumstances of production and increase the food quality.