Your explanation is difficult to understand, but the pictures tell stories.
1. You installed and tightened the D string the wrong way. The string should come off the peg over the top. In other words, you turned the tuner the wrong way. Look at the A string; it is correct.
2. The nut grooves look bad. Each string should lie at least halfway "proud" of its groove, and there should be no room for the string to move sideways in its grooves. The E, A, and G grooves are way too deep, the E groove is too wide, and the D groove is not deep enough.
3. there is no need for the string to have so many turns around the peg. Put enough of the string through the peg hole so that the string does not rub against the cheek of the peg box when tuned to pitch.
You write "I started to tune down and at that moment I could no longer give up, just down." If you mean that you can't tune the string UP, that's okay, because you shouldn't be trying to do that. You should take the string off and start again - AFTER fixing the nut situation. Buena suerte!