@Naligurtan You can create a power automate flow as shown in video to create folders and sub folders. Then you have below two options to create a button in SharePoint online document library:
Using JSON formatting: You can create a button in library using JSON to run a power automate flow. Check this: Create a button to launch a Flow - note that this button will be added against each file/item in your library
Using SPFx list view command set: Create a HTTP triggered power automate flow and run it using button create via SPFx list view command set.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.