Well, he didn't write it.
Context: When told that General Edwin Sumner had no faith in the Bible, Grant replied:
Ulysses S. Grant, 1822-1885, 18th President of the United States (Republican, OH), Quoted by Charles Eliot Norton, Letter to Thomas Carlyle, May 7, 1874
Sourced by: Eigen's Political and Historical Quotations