Lignin does a few key things in plants. Lignin and cellulose come hand and hand in plant structures. Together they provide structure and support to a plant, especially woody plants.
A good analogy of cellulose and lignin is fiberglass and epoxy resin. That kind of materials construction is used in boat building. You can think of the cellulose as the fiberglass. It is the main load bearing component. It can't do any good though unless it is held together. Otherwise it would crumble on itself. That's where the lignin comes in. It acts as the epoxy resin for the cellulose, and together they both provide a great deal of stiffness and rigidity.
Land plants need that kind of rigidity, because they are constantly working against gravity. A water lily is doing that also, but a) it never grows that tall and b) it is constantly being buoyed up by the water that it rests on. Human bones could be a lot less rigid too, if we didn't need to support ourselves against gravity all the time by living in an aquatic environment. The fact that astronauts lose bone density while in orbit is solid evidence of this.
More lignin means more rigidity and vertical support. That means the plant can grow taller. Taller means more access to sunlight for continued photosynthesis. That's why trees are taller than grasses. More cellulose and lignin makes them woodier and more rigid; therefore, taller before bending under their own weight.
Lignin is also not super hydrophilic either. That means it doesn't absorb much water. That means it allows the xylem to effectively transport water to other locations. A water lily doesn't have that kind of demand. It's almost entirely immersed in water, so being efficient with water is not a priority.