@jay_s_uk The problem got solved, I had ' if else ' formula in the beginning of the config.g file that wasn't formatted right. I removed it and then the config.g started to work -> endstops got recognized.

The thing was that it didn't say it in any place that there's mistake. But the when loaded with M98 command the error became visible and that helped to solve the problem.