Martin has finished his book. Martin had given them an outline and they following what Martin had written.
There are going to be seven books total, and he's only finished five so far.
He did sit down a few years ago with the writers and tell them the "big picture" of how it was supposed to end. But he's also gone on record saying that he unhappy at a lot of their storyline decisions.
https://www.express.co.uk/entertainment/books/1123230/Game-of-Thrones-George-RR-Martin-HBO-ending-books-change-differences-Iron-Throne-die
Martin gave them an outline years ago, and has clearly said that the show is going in a different direction for the ending than what he is planning in the books. He has not been heavily involved in the show since around season four, instead he has been trying to focus on finishing the books.