How do I link objects to a line?

My problem is this:
I have a wall of boxes and a line next to that same wall. The effect I want to create is that if I move a vertex of that line the base of the wall moves with the line while the top stays in place and everything in between is connecting the two.
The result that needs to come out is that I have some kind of terraced wall.

In attachment I put a pdf file with the result I want to have.(I did this box by box, pretty intensive)

I hope this makes sens to anyone.

please help!

problem.pdf149.65 KB