Just as a side bar, there are more then 14 (0-13) digital pins available on your nano by utilizing the six analog input pins as digital pins. This can be done either by using pin names as follows:
digitalWrite(A0, HIGH);
or
digitalWrite(14, HIGH);
If one just wants to generate a fixed square wave at the highest possible frequency one can utilize one of the timers to directly drive a output pin using internal hardware, and I seem to recall that the fastest speed possible will be 1/2 the clock rate, so 8 MHz for a 16 MHz clock.