First of all, just use luckperms. But I'll post both
on right click:
if player's held item is book:
execute console command "pr setrank %player% vip"
for luckperms
on right click:
if player's held item is book:
execute console command "lp user %player% parent set vip"
Not efficient but it works