‘In to’ just happens sometimes. "I went in to buy some milk." In that sentence the ‘to’ is part of the infinitive ‘to buy.’
If you aren't sure which one to use, change the ‘in’ to ‘in order’ and see if it still works. "I went in order to the store" is wrong, but "I went in order to buy some milk" is right.