I believe the negative of a sentence, in which an infinitive is used, is made in two different ways.
For example, "I know what to say." can be negated as follows;
- I know what not to say.
- I don’t know what to say.
However, I often come across the swapped version of "not to" as follows;
- I know what to not say.
Other examples follow;
- Tom had enough sense to not go out by himself after dark.
- I want you to not go to Boston with Tom.
- Why did you decide to not go to Boston with Tom?
Grammarly finds the third way to be fine.
Google Books Ngram Viewer prefers not to over to not in general.
I need to know if the third way of negating an infinitive-sentence is grammatical. Please, explain!