What is the purpose of custom script and how it works in erp next
IT allows you to add your own custom script on top of existing core scripts, and the best of all is, it doesn’t get replaced during a system upgrade.
https://erpnext.org/docs/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples
For that you must have system manager role