Highest PWM frequency output for the Uno/Nano

Does it still source the maximum 50mA current?

20 mA more like. 40 mA is the absolute maximum.

Does this code also work for the nano?

I imagine so.

Does the code work for all digital pins?

The timers have fixed output pins. Each timer has two pins dedicated to it which is why you have 6 PWM outputs on the Uno (3 timers x 2 pins each).

I just tried to move part of the code over to loop and the signal is no longer steady and 50% duty cycle i guess because there is some time lag with the restarting the loop? So this method only works under void setup()?

That doesn't make sense. Show your amended code please. Once you have the timer set up it doesn't matter what the code is doing. However if you put that code into loop it might be restarting the timer very rapidly. You don't want that.

The timer (that I showed) runs independently, so that is why I had it in setup. You don't have to keep calling the code. It's all done in hardware.