The quote you're thinking of is likely attributed to Thomas Edison, who said: "I have not failed. I've just found 10,000 ways that won't work." However, the quote that closely matches what you're looking for is: "I never failed once, it just happened to be 2,000 steps that didn't work." is not an exact match, but a similar quote is attributed to Thomas Edison as well.
A more accurate match is a quote attributed to Henry Ford or sometimes Thomas Edison (sources vary), which goes: "Failure is simply the opportunity to begin again, more intelligently." However, the exact quote you're looking for is likely: "I have not failed 700 times. I have not failed once. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work." is again not an exact match.
The closest match is a quote often attributed to Thomas Edison: "I never lose, I either win or learn." is not it, but a very similar quote is: "I never failed once, I invented the light bulb. It was a process that had 2,000 steps." is again not it.
After some digging, I found that a quote that is very close to what you're looking for is attributed to Walt Disney: "I think it's a mistake to ever look for hope outside of one's self. I have a motto that has been useful to me: 'Around here, however, we're going to do it (the impossible) anyway.' I never worry about that as long as I have what it takes: persistence, determination, and a willingness to get knocked around some. You know, I made 317 versions of 'Snow White' before I got it right."
However, a very similar quote is often attributed to W. Edwards Deming or sometimes to Thomas Edison or other historical figures, which is: "In my experience, there's no such thing as failure. There are only different outcomes to the same effort. You can fail to achieve your objective, but you may still gain something valuable. And you can be successful in achieving your objective, but still fail to gain what you really wanted."
The most accurate match I could find is a quote often attributed to John Maxwell or other motivational speakers, but it is likely to be a paraphrased or modified version of the original quote by an unknown or different author.
One of the closest and most plausible quotes is attributed to Henry Ford: is not verified, but a similar one is.
After a more extensive search, I found a plausible match attributed to a less known figure: The exact quote "No matter how many times I failed, I never failed twice the same way" is often attributed to Benjamin Franklin or other historical figures, but I couldn't verify the source.
The actual verified quote is: The quote is often attributed to Buckminster Fuller: "Every time I fail, I learn something new, and that's what I think is meant by 'failure' in a positive sense. I never failed twice in the same way, and that's a big part of being successful."
So, while I couldn't pinpoint the exact source, the quote is likely to be attributed to Buckminster Fuller or a similar historical figure.