heat flows out of the gas during the path B→C→D
work done during the path A→B→C is zero
the process during the path A→B is isothermal
positive work is done by the gas in the cycle ABCDA
ΔQ=ΔU+W
For process B→C→D ΔU is negative and W is also negative, so ΔQ is also negative, hence heat flows out during this process.
A to B, work is +ve. B to C work is −ve. But +ve work is more, so net work is not zero in process A→B→C.