How can we generate a shared key from two key pairs for an ECC implementation? This is the diagram of an ecc implementation here that needs to generate the shared key, how can it be done?
The diagram leaves out something (rather assumes it implicitly), which is that you and the recipient have agreed upon curve parameters / a standardized curve with which to perform key exchange. We can derive the shared key as follows once we agree upon parameters (this method is basically elliptic curve Diffie Hellman):


Use the RNG to generate an integer $d \in \mathbb{Z}_q$ where $q$ is the order of the generator point $G$ of the curve (technically $d$ can be arbitrarily large but there's no advantage to this).
Your ECC key pair is then $(d, Q)$ where $Q = d*G$. $d$ is the private key, $Q$ is the public key. Note that $Q$ is a point on the curve.
Given the recipients public key $R$ (also a point on the curve) compute $S = d * R$. $S$ is the shared secret. (Note that if $e$ is the recipients private key that means $R = e * G$, and thus $S = d * e * G$, meaning if we send the recipient our public key $Q$ they can also derive the secret $S = e * Q = e * d * G$).


Now we have shared key material we can pass into a KDF to derive symmetric keys.