Draw line between two elements

Hi, i am a beginner in creating worlds, I want to create a world where you select two elements and a line is drawn between them, could you help me? Thank you.