Each one of the endpoints have it's own pair of keys a private and a public one, what is shared is just their public keys, each one have the other's public key, uses it to encrypt the data before sending it.
for addition: Generally RSA or asymmetric encryption algorithms are not used as a standalone algorithm, they are used just share a symetric session key, and here is how it goes :
suppose that there are two endpoints A and B,
A, generates a pair of keys a pirvare and a public one, sends the public one two B.
B, generates a symetric session key, encrypt it with the received public key, and send it back to A.
Now that A and B have a symetric session key, they will communicate using it, as symetric encryption algrithms are much faster than the asymetric ones.
the asymetric session ensure that the symetric session key is transported safely.