I assume you are using rpg maker xp.
1) Page 1 command: CONTROL VARIABLES
name the variable #001: HERO level [name can be different,,variable # can be different]
Set it to: ACTOR, select your main hero, then LEVEL
2) Page 1 command: CONDITIONAL BRANCH
Variabe: #001 HERO level
greater than or equal to
Constant: 40 [checkmark the set handling when conditions do not apply
Call SHOP [add items for level 40 hero]
3) in the ELSE section
Repeat step 2, except make the Constant: 30 [or 20, or 10, or 1]
4) Repeat step 3
I don't want to post the full tutorial with pictures for this.