Happy to provide a bit more clarification:
User-data can be either YAML or a script format supported by the droplet’s OS by default (ex. Bash). When using a non-YAML script whitespace is only as much of a concern as it would be for any other script in the language you use.
You can paste a user-data script into the create page in the control panel. Check the user-data checkbox in the optional settings and the text box will appear to allow pasting the script.
You can also send user-data via the API populating the user-data field in your request to the create endpoint.
On first boot after it fetches it’s network configuration and other basic settings cloud-init will automatically run your script. Make sure that it is non-interactive as any prompt for user input will cause it to stall since there is no user to enter the needed information. You can log into your droplet and view the output of your script (if you’re installing a lot of things you can use tail to watch it actually run in real-time if you’re quick enough) in the file