In Interstellar, after Cooper arrives in the Tesseract, Cooper tries to send the message STAY to his daughter in the past so she won't let him go on the mission. If that was his intention then why did he send the coordinates of NASA afterwards? If he didn't send the coordinates, he wouldn't have found NASA or go into space, he would have stayed.
He first sends the message of STAY. Remember the scene in the beginning of the movie just before Cooper visits the teachers of his children. We are shown that Murph has some thick lines on her book. In the end we are shown that she is actually figuring out the morse code behind the falling books represented by the thick lines. Thus she was indeed receiving the messages of STAY before getting the co-ordinates.
Now in the teseract Cooper initially wants Murph to stay in the room, so he sends the message of STAY. When he realises that what has happened in the past cannot be changed, then he wants to save the future of mankind. That is why he sends the location of NASA to his past self.
Because Cooper was only saying STAY out of confusion and panic. To set the scene, Coop has just committed suicide to allow Brand to survive the slingshot to the other planet, and plunged into the unknown that is Gargantua, a massive Black Hole. Nearly passed out, he ejects from his exploding Ranger spacecraft, only to be thrown into a Tesseract, a 3rd Dimensional representation of 5th Dimensional Space. He sees a young Murphy through the back of the Tesseract wall, calls out to her but she can't hear him and he still has zero clue about what is happening. He doesn't know if he's alive or dead or what. He knows that Murph has experienced Decades without him due to temporal relativity and may be dead relative to him as well. The entire mission may have been pointless, and in the end he will die without his daughter. Panic sets in.
Here he goes through an accelerated Kübler-Ross Model/The 5 Stages of Grief.
- Denial: He goes into the Black Hole believing that maybe he'll make it out alive. When he arrives in the Tesseract he still doesn't know what's happening.
- Anger & Bargaining & Depression: He sees himself and Murph and he lashes out against the Tesseract walls. He punches and yells and attempts to get Murph to make his past self to stay. He breaks down sobbing when it fails.
- Acceptance: He, with TARS help, accepts that he can't change the past, but he can make sure that it was not in vain. He finally understands what is happening. He gives up on STAY and moves on to something useful, like saving mankind by giving Murph the Quantum Data.
Once he realizes his situation, how the Tesseract works, how They are facilitating the changes, he is no longer panicking and can think rationally. He finds the right time to give the NASA Coordinates and then the Quantum Data. Once he ensures that the past has come true, They close the Tesseract.
IIRC he sends stay before he realises the importance of his and her mission, then decides to send the locations of NASA as well as encode the quantum data.
I think that Cooper saw his neccesity on the team as a key motivation for giving the coordinates. The team was lacking an experienced pilot and if it wasn't for his earlier decision to depart on Miller, the entire mission would have been for nothing potentially wasting millions (or billions) of earth lives.
This is one of the key plot points of the movie. The juxtaposition of Cooper and Mann's motivations and actions. Cooper was willing to go even at the cost of his life and his family's happiness because he saw the greater need of all humanity. Mann only appeared willing to die for humanity, when it came time, he sacrificed the chances of humanity rather than giving his life.