If you say that you can’t help doing something, you mean that you can’t stop yourself from doing it: something makes you do it even though you don’t want to.

Note that after can’t / couldn’t help, we use an –ing form not an infinitive.

I couldn’t help crying when I heard the news. (NOT I couldn’t help to cry when I heard the news.)

She is not very beautiful, but somehow you can’t help liking her. (NOT … but somehow you can’t help to like her.)

I couldn’t help overhearing their conversation. (NOT I couldn’t help to overhear their conversation.)

http://www.englishspeaking.org/cant-help/