how to get what interaction entity was clicked more precisely?

i'm making a custom block that summons a interaction entity at itself when a near player is holding a item, and that is already done, but idk how to tell wich interaction entity was clicked when they are close to each other. currently i get the click using an advancement. and this is the function that summons the interaction entity

Continue to help post