I began running and doing a lot of exercise lately in order to lose weight. I'm trying to lose about a good 26 pounds by August. But I've been gaining instead?

Yeah, everyone's saying that its the muscle that's heavy so that is why i'm gaining..but:
*How do I get to the point where I'm exercising, but LOSING the weight, NOT GAINING it?? what do i do? i dont wanna stop exercising