Why is the digital out acting as ground on arduino?
When an IO pin is configured as an OUTPUT, and is set LOW, it is effectively connected to ground through a MOSFET.

You get a reasonably low resistance between the IO pin and ground.

As long as you don't exceed around 25mA through that pin, then all is well, and that technique is often used for multiplexing of LEDs etc.