Mary used to work for WCKD but left due to "creative differences" in how to approach the cure. Mainly that Ava is evil for abusing of children like that. Mary and the Right Arm have been actively interfering with WCKD by liberating Immunes, which WCKD sees as a genocidal act against saving humanity.
So they killed Mary to get rid of the problem.
Of course, they are not working for the same cause. Mary is willing to save Immunes so they can repopulate, at the expense of current human population. Ava is willing to torture and kill children to save the current population (i.e. herself).
Update: You seem to have misunderstood the scene with Brenda being "cured". The enzyme that's extracted from the Immunes is not a long term cure, or vaccine. It doesn't 100% solve the issue of the Flare affecting people that are not immune. It's a treatment. It gets rid of the infection for a short time. Brenda is only "cured" of that specific infection, and can get infected again (or it only stops the infection for a few months and she will turn into a Crank at that time, the movie was a bit unclear).
It would need to be injected regularly for it to be 100%. And the only way to produce the Enzyme is to make an Immune's brain work overtime, the entire point of the Trails. It can't be artificially manufactured. The only way to produce it is by torturing children, then hooking them up to a machine to drain their brains.
The books and the movies diverge. First the books only have a small number of gladers, the ones from the boy maze and a girl maze, around 20 survivors. The movie has many more. Movie WCKD believes in cultivating all the immunes for the Enzyme, not exactly a cure cure. It also, maybe, goes with the book motivation, in that WCKD is putting the gladers through a set of trials to find the "ONE" immune at the end, that will get his head chopped open and the "Killzone" part of the brain examined so that it can be reproduced, in the end creating the cure.
In short, the cure has not been found yet, and the Trials that WCKD is conducting is to find the cure by pushing the kids to the brain's most efficient point.