Neither At Dawn We Slept, written by the highly respected Gordon Prange, nor The Reluctant Admiral, the definitive biography of Yamamoto in English by Agawa Hiroyu, contains the line.
Randall Wallace, the screenwriter of Pearl Harbor, readily admitted that he copied the line from Tora! Tora! Tora!. (Pearl Harbor is not troubled by accuracy; among other examples of dramatic license, it shows Yamamoto saying those words while standing on a carrier in the attacking force despite the fact that he was on board his flagship anchored at a naval base in Japan throughout the attack.)
The director of the movie Tora! Tora! Tora!, Richard Fleischer, stated that while Yamamoto may never have said those words, the film's producer, Elmo Williams, had found the line written in Yamamoto's diary. Yamamoto, however, never kept a diary. Williams, in turn, has stated that Larry Forrester, the screenwriter, found a 1943 letter from Yamamoto to the Admiralty in Tokyo containing the quote. However, Forrester cannot produce the letter, nor can anyone else, American or Japanese, recall or find it.
Yamamoto certainly believed that Japan could not win a protracted war with the United States, and, moreover, seems to have believed that the Pearl Harbor attack had become a blunder - even though he was the person who came up with the idea of a a surprise attack on it! The Reluctant Admiral relates that "Yamamoto alone" (while all his staff members were celebrating) spent the day after Pearl Harbour "sunk in apparent depression". He is also known to have been upset by the bungling of the Foreign Ministry which led to the attack happening while the countries were technically at peace.
The line serves very well as a dramatic ending to the attack, and may well have encapsulated some of his real feelings about it. It does not seem, alas, to have been real.
Interestingly, the other common Yamamoto quote predicting the future outcome of an attack on the United States ("I can run wild for six months ... after that, I have no expectation of success.") is real, and is something he is recorded to have said to a number of different Cabinet members in Japan in the 1940 time period. It was probably part of his standard appraisal of the situation.