How can I have a line stay between to points as one or both of them moves?

Hi I am trying to make a script that makes a box stretch itself to always touch two other boxes regardless if on or both of them moves, I have tried a lot of different things , I think I got the stretching working but when one of the boxes moves the box in the middle that stretches and rotates rotates out of course and don't stay between the other two boxes.

Maybe you can add the code you've been using so far so we have something to refer to?

It seems your problem is not the stretching but the rotation.

To make an object always look at another, use the example code here: Quaternion.LookRotation