Reset Default Configuration Script

Dear all,

I’m trying to create a script that will reset the default configuration of router and other devices (connected to the router,login via ssh on router).
May I have some the same script or documentation to refer

Many thanks!