Making molecular machines that can be useful in the macroscopic world is a challenging long-term goal of nanoscience. Inspired by the protein machinery found in biological systems, and based on the theoretical understanding of the physics of motion at the nanoscale, organic chemists have developed a number of molecules that can produce work by contraction or rotation when triggered by various external chemical or physical stimuli. In particular, basic molecular switches that commute between at least two thermodynamic minima and more advanced molecular motors that behave as dissipative units working far from equilibrium when fuelled with external energy have been reported. However, despite recent progress, the ultimate challenge of coordinating individual molecular motors in a continuous mechanical process that can have a measurable effect at the macroscale has remained elusive. Here, we show that by integrating light-driven unidirectional molecular rotors as reticulating units in a polymer gel, it is possible to amplify their individual motions to achieve macroscopic contraction of the material. Our system uses the incoming light to operate under far-from-equilibrium conditions, and the work produced by the motor in the photostationary state is used to twist the entangled polymer chains up to the collapse of the gel. Our design could be a starting point to integrate nanomotors in metastable materials to store energy and eventually to convert it.