Highest PWM frequency output for the Uno/Nano

Don't do that in loop.

Quoting myself, who you have chosen to ignore:

However if you put that code into loop it might be restarting the timer very rapidly. You don't want that.