You can also just remove the word "but" in your case.
For example, either of the following two sentences is correct.
I couldn't help but laugh.
I couldn't help laughing.
You can also just remove the word "but" in your case.
For example, either of the following two sentences is correct.
I couldn't help but laugh.
I couldn't help laughing.