The current available documentation around the topic on how to write an own NASL script is pinned in this category at the top:
For the question how to make the software stack / components aware of the new NASL script a new question in the following category is required as this is outside of the scope of the “Vulnerability Tests” category due to being a functionality of the software stack and not the NASL script: