cannot, can not, cannot but

  edgood  —  Grammar Tips
Use one word, not two. Thus: cannot.

Can’t is the contracted form of cannot, meaning the negative of can. In formal writing, it is perfectly acceptable to use contractions.

Some object to the idiomatic expressions cannot but and can but, criticizing them as double negatives. But these expressions find support and considerable use among top writers. The but in cannot but means “except,” much like the expression “no one but.” Thus:
I cannot but wonder about his methods of leadership.
These days, you’re more likely to encounter cannot help but:
I cannot help but wonder about his methods of leadership.
Example: She cannot win the race because of her recent illness.