How to make an undo button

I have tried many things but I just cannot find the right code to make an undo button. I am seeking help to make this code pls give me hints. Thank you!

Welcome to the community, Praveen! Are you trying to implement an ‘Undo’ feature on a Paint app? If so, you can check Scott’s post here:
https://groups.google.com/forum/#!topic/app-inventor-developers-library/yF2Auslt82M

Here’s one …

And another …