Well, the difference is that with a for-loop you're only looping through the original string, whereas with your while you were looking at a new one each time. You were doing different things with them, they can still do the same things.
Something you should take note of here is that you are creating a lot of strings (each time you replace you copy the whole or almost the whole thing) so if you for example ran this on a whole book, then it would be faster to just do the job by hand due to the extreme amount of work this would be doing.
The replace function does quite a lot of work, it's meant to be used once, not once for each character in a string. So it's important to know what the things you use actually do so that you can write code that ends up executing a reasonable amount of work for the task at hand.
A more sensible approach would be to loop through the string once in total, same as how a human would do it.
Strings also cannot be changed, so this more sensible approach would need an intermediary data type that can be changed which can then be fed to the string constructor to create the final result. (Now it's actually looping through it twice and actually a few more times, but multiplying by a constant is fine, that's just saying there are multiple steps to do. Copy the whole thing once for each letter is much, much worse)