diffie hellman digital signatures vs MACs
The homework task is making an implicit assumption:

They don't have a common shared secret.

That's implicated by the fact that they do a DH key exchange and nothing else to exchange the key. A common shared secret would offer muc more possibilities, e.g. combine a DH key exchange with the shared secret as input to a KDF.

You realized yourself that a shared secret is required for MAC. So what protects the DH  key exchange from man-in-the-middle attacks? Because (not-authenticated) DH key exchange is vulnerable to that.