Generating Square Wave with with modulated carrier frequency

You could gate an external oscillator using two PWM outputs. Both at 50% when A0 is at 0%. Then as A0 increases, one reduces PWM, the other increases PWM. An external XOR logic is used to gate an external 5MHz clock.

But - what kind of resolution do you need and how accurate must that 18kHz be? You can set a higher PWM frequency from the Arduino, but it isn't infinitely variable, and the resolution (bit depth) is reduced at higher frequencies.

I come from a hardware background. So I picture doing this with a crystal oscillator divided down to 5MHz and 18kHz, using a ramp to generate the PWM signals, XOR to gate the 5MHz signal, and use the Arduino to control the ramp/PWM generator.

I'm sure someone here can help with doing nearly all (or all) in software. Perhaps with something faster like a Due or Teensy 3.1.