Arduino to behave as a simple switch

Is it possible to program arduino to short two outputs?
Let say I'm controlling one led by simple latching switch. So I remove the switch and connect wires to
arduinos analog output 6 and 7.

Can Arduino simply short those two outputs?

I'm not going to control the led this way. This is just hypothetic question…

Can Arduino simply short those two outputs?

No.

You will have to use external hardware for this. Maybe the most universal way would be to use an optically isolated FET.