Form.addButton(options)
Method Description: Adds a button to a form.
Returns: serverWidget.Button object
Supported Script Types: SuiteScript 2.x Suitelet Script Type and SuiteScript 2.x User Event Script Type (beforeLoad(context))
Governance: None
Module: N/ui/serverWidget Module
Since: 2015.2

We will execute the form.addButton() in the userEvent script as it is only supported in the SuiteScript 2.x Suitelet Script Type and SuiteScript 2.x User Event Script Type (beforeLoad(context)).
The function that is to be triggered while clicking the button will be written on the client script and the client script will be connected to the userEvent script using,
form.clientScriptFileId = “internal id of the client script”
form.clientScriptModulePath = “path of the client script file”