You mean when it gains one level or a level, it will gain 1 Lumber? Well, that is quite basic.
You can just make a trigger that when a unit gains a level, for the conditions possible if you set if its a hero that is triggering and what specific hero and for the actions, Add 1 lumber to the Owner of Triggering unit.
Want a trigger?