When Cooper initially arrives in the tesseract, he doesn't really know yet how things work or what he is actually supposed to do, let alone that he can't change the past. He's struck with emotion and confused at the scene.
So in the same way as he just wanted to return to his daughter on a dying planet after learning that Plan A supposedly failed, he now wants at least his past self to STAY with his daughter and not go on this futile journey. He doesn't yet fully realize that this is the exact same message he already ignored.
However, once TARS shows up with some enlightening dialogue, Cooper starts to realize what's really going on and that he can actually do more than just send the STAY message.
Cooper: You survived?
TARS: Somewhere. In their fifth dimension. They saved us.
Cooper: Who's 'They'? And why would they help us?
TARS: I don't know, but they constructed this three-dimensional space inside their fifth-dimensional reality to allow you to understand it.
Cooper: It isn't working!
TARS: Yes, it is. You've seen that time is represented here as a physical dimension -- you even worked out that you can exert a force across spacetime.
Cooper: Gravity. To send a message...Gravity crosses the dimensions -- including time -- And you have the quantum data, now...
TARS: Cooper, they didn't bring us here to change the past.
Cooper (realizing): No, they didn't bring us here at all. We brought ourselves here...TARS, feed me the coordinates of NASA in binary...
This is the moment Cooper realizes that he can't change the past, only the future. And that he can actually help the humans on Earth with the quantum data only they could gather. And this is also the moment where he sets the events in motion, as he realizes that it's a closed loop.
He didn't want his past self to stay anymore, since he realized he could actually do more than just dying with his daughter on a lost world, he could save her, he could save them all! And that's the sacrifice he brings for humanity (since he didn't know he could still return to her).
So between the STAY message and the NASA coordinates is the moment when Cooper realizes that he approached the problem in the wrong way at first.