I need to created one activity, which will create the ruleset versions automatically, which means if am running that activity it should automatically create ruleset versions and also lock the ruleset versions automatically.
You need to create a declare trigger in the class Rule-RuleSet-Version. So, whenever a new instance will be created, the declare trigger will execute an activity (need to be created), which will generate another ruleset versions.
The Lock and Roll feature (Designer studio > Application > Structure > Ruleset Stack) does the same thing that I believe you are looking for, i.e., an option to lock existing RSVs and create new versions of those and update the application as well.
You can check the design of Lock & Roll button on pzCurrentRuleSetStack section to see if you can reuse it on your user portal.