Hi @VikiH the little green thing called Magic Beans is for you to collect, when you already have enough magic beans, you can buy shovels to help you to do your task, and also to overcome Rancid on Rancid level. You earn the free beans from finishing your level and it depending how stars you get, or you can collect them by getting lives from friends ( every 5 lives it will convert into a magic bean )
A Warm Welcome to the King Community, where you can seek Answers / Suggestions from your fellow players in any King Games' Sections
With regard to your Question, my friend @mysticalmysty explained very nicely. I am adding a little extra to what she wrote -- For each level we won, we receive 75 Magic Beans for 1 Star; 150 for 2 stars & 250 Beans for 3 stars. If you receive a single star on a level and play the level again, you will receive Beans again when you gain a new Star (either 2 or 3 stars). We will receive these Magic Beans only for the first time we gained the Stars. Let's say you played level # 10 with 1 star and gained 75 beans, then go back and gain 3 stars and receive the 250 beans, you have reached the limit. Now, you will have to move to the next level.