If I am writing a book and want to use a quote, but I either don't remember who said it or I am uncertain, how should I credit the quote?
The first order of business is to acknowledge the quote as someone else's work and not your own by putting quotation marks around it. "I think therefore I am."*
The second thing to do is to cite the type of source, even if you don't know the exact one. "As she said in a song from an old movie, 'I'm as corny as Kansas in August.'"
Then you go on a site like Movies and Film SE (or Quora) and ask, "What old movie does the following line of an old song come from?"
And hopefully, you'll get the answer: ("I'm in Love With a Wonderful Guy," South Pacific, Rodgers and Hammerstein.)
Since you are writing a book and not a blog, better search more and try to find out who said it.
If you are still unable to get the result, go for "unknown" or "a wise man/woman once said...".
If your book is fiction then you have the option of attributing the quote to an unreliable character then having another character recognize the mistake either publicly or in internal/thought dialogue.
For example, have your antagonist credit Shakespeare for "I think therefore I am" then have your protagonist thinking, "What an idiot! That's not Shakespeare!".
Your protagonist is not then required to provide correct attribution. A change in the scene might distract them, leaving the attribution uncorrected.