I read that D-H is used to make a shared secret between parties that then they use to encrypt the messages.
This is used in TLS, for example, after the server has authenticated itself with a certificate.
But, if I understand correctly, the certificate has server's public key to use for encryption. Why not just encrypt the secret (or symmetric key) with that public key and send that to the server?
EDIT AFTER MARKED AS DUPLICATE: The marked duplicate question Is there any particular reason to use Diffie-Hellman over RSA for key exchange? is asking why prefer DH over RSA (ephemeral DH and ephemeral RSA I think?) for symmetric key exchange. I'm asking why use any of them at all (DH, or ephemeral RSA), why doesn't client just send the symmetric key encrypted with server's certificate public key? Reading the marked duplicate, and https://crypto.stackexchange.com/questions/29744/can-an-ephemeral-rsa-key-give-forward-secrecy I came to the conclusion that my proposal can be used for symmetric key exchange in TLS-like protocol if we do not care about PFS (perfect forward secrecy), and the reason for using ephemeral DH or ephemeral RSA as additional step is only to achieve PFS. Am I correct?