She tried not to cry, but she couldn't help it.

Literal

She [topic-は] cry-not [so-as-to-ように] did [but-が], no-good was.

~ないようにする ('try to make it so that one doesn't') is the everyday counterpart to the more formal ~ないように努める. The clause-final が works as 'but,' clipping a contrasting outcome onto the attempt. だめだった is plain, colloquial 'it was no good' — used after attempts to dismiss the result as a failure. The whole structure 'X-nai you ni shita ga, dame datta' is a recurring everyday template for narrating a try that didn't work.