The full scene from the movie goes as follows:
I didn't think it would end this way . . .
GANDALF looks at the SMALL HOBBIT a beat.
End? No, the journey doesn't end here.
PIPPIN looks up at GANDALF, questioningly . . . .
Death is just another path, one that we all
ANGLE ON: GANDALF looks down to see PIPPIN looking up at him
with fear in his eyes . . .
The grey rain curtain of this world rolls
back and all turns to silver glass . . .
and then you see it . . .
ANGLE ON: GANDALF breaks off, lost in reverie . . .
What, Gandalf? See what?
White shores ... And beyond . . . A far green
country under a swift sunrise.
PIPPIN stares up at the OLD WIZARD'S FACE, softened, quiet
and full of peace . . .
The Return of the King Screenplay
The later part of Gandalf's quote ("The grey rain curtain of this world rolls back and all turns to silver glass ... and then you see it . . . White shores ... And beyond . . . A far green country under a swift sunrise.") is, as you say, found in two sources from the book:
That night they heard no noises. But either in his dreams or out of them, he could not tell which, Frodo heard a sweet singing running in his mind; a song that seemed to come like a pale light behind a grey rain-curtain, and growing stronger to turn the veil all to glass and silver, until at last it was rolled back, and a far green country opened before him under a swift sunrise.
The Lord of the Rings - Book I Chapter 8 - "Fog on the Barrow-Downs"
And the ship went out into the High Sea and passed on into the West, until at last on a night of rain Frodo smelled a sweet fragrance on the air and heard the sound of singing that came over the water. And then it seemed to him that as in his dream in the house of Bombadil, the grey rain-curtain turned all to silver glass and was rolled back, and he beheld white shores and beyond them a far green country under a swift sunrise.
The Lord of the Rings - Book VI Chapter 9 - "The Grey Havens"
This was added here by screenwriter Fran Walsh, because she liked the lines in the book and wanted to try fitting them somewhere into the movie.
Philippa Boyens: As a fan of the books, you fall in love with certain passages and then-- And then sometimes you-- And you hoard them and then you try to make them work. And Fran came to me with this scene that she'd written with the lines from the book, which describe what Frodo sees when he passes over towards the Undying Lands.
Tom Shippey: That is the image that Tolkien has of the land, the other side of death. That's what you're going to.
Brian Sibley: What the filmmakers did was to take the essence of that description and to give it to Gandalf in describing just such a scene to Pippin.
Ian McKellen: Splendid words to say, and, I suppose, touching that Gandalf should choose to say them as words of comfort to a young man.
Philippa Boyens: And Ian McKellen read it, and knew exactly what to do with it immediately and so did Billy.
Billy Boyd: You know, he'd have me in tears just telling me about this far green country.
The Return of the King Extended Edition: The Appendices, Part Five - The War of the Ring - "From Book to Script - Forging the Final Chapter" [5:42 - 7:38]
The first part of Gandalf's quote ("End? No, the journey doesn't end here. ... Death is just another path, one that we all must take."") does not appear in the book. Seeing as the entire scene was written for the movie because Fran Walsh liked the description of the Undying Lands, I think it's safe to assume that these lines were just newly invented lines added in to introduce them.
Of course, it's worth noting that when these words are placed in this context they make no sense. Gandalf is a Maia who cannot die, and Pippin is a Hobbit, part of the race of Men, of which Tolkien strongly said that no one other than Eru knew of what happened to them after they died.
There's one scene where I think is it Pippin and Gandalf where they're talking about death and Gandalf says in speech essentially the scene that in the book is where Frodo reaches the undying lands. I thought that was a fundamental betrayal of one of the fundamental themes of Tolkien and this is why: Men do not know their fate in Middle-earth. Gandalf is basically telling pippin when you die you're going to go to heaven and everything's going to be great. Gandalf doesn't know that, and men certainly don't know that. I just thought that that cheapened the whole thing. It also gives a false impression that Frodo went to heaven, but he didn't. He went to Tol Eressëa and then he lived there for a time until he was healed, as healed as he was going to get, and then he too died and then went who knows where. Not back then, it's pre-Christian, there is no promise.
Nerd of the Rings interview with Carl Hostetter [47:20]