Arduino Yun - Digital Output

I don't understand your question.

You are using digital pins 22 and 23, which are aliases for the analog pins A4 and A5, as you correctly say in your question. But then you ask how do you hook up a relay to them? You can do so by connecting to the A4 and A5 header pins.

When you use digitalWrite() for pins 22 or 23, you are telling the processor to drive pins A4 or A5 as digital outputs. You would hook up a relay to these pins in the same way you would any other digital pins.

Pins 0 through 13 can only be used for digitial input or output. (Some can be used with analogWrite() but they are not real analog outputs, they just use PWM and vary the pulse width, approximating an analog output.)

Pins A0 through A5 can be used as analog inputs, but they can also be used exactly the same as digital pins by using pin numbers 18 (for A0) through 23 (for A5.)