Rotation along curve

Hi, i am sure this has been asked before but i couldnt find a solution exact to what i was looking for. My issue is really simple. how do i rotate a given box such that it is always tangent to the curve given?

I have attached my files, i believe i am close but i am missing out something, it would be great if i could get some help on this.

Thanks in advance.

It was a smart way as you were trying to do it, but luckily there are components that can do it much easier.
Only one tip for posting in the forum:
a) so as not to upload both GH and RH files, you can just internalize your geometries and upload only the GH file.
b) while in GH, if you press ctrl-shift-Q, it creates an image just like the one bellow so that people can understand your problem better. (7.9 KB)

Hey thanks so much for helping with the script and tips. really useful and appreciative of people like you on the forum :).

Haha i have always seen the screen shot image but never figured out how to do it also. Thanks again!