Luke Skywalker originally intended to leave Ahch-To and rejoin the Resistance with Rey in Star Wars: The Last Jedi. The pair’s dynamic was described as the beating heart of the movie, as the young scavenger attempted in vain to convince the grizzled Jedi to pick up his laser sword and take on the First Order.
In the book, this additional scene takes place after Luke reawakens the Force inside him and Rey has her experience in the Ahch-To cave.
Luke believed him to be lost, but Rey felt he could be saved and become a valuable ally.
Since Luke was seeking out Rey after his reawakening, he probably had a return in mind.