You could do something as simple as follows:
1#!/bin/bash
2
3ls /Library/LaunchDaemons > "Filename/Location" &&
4ls /Library/LaunchAgents >> "Filename/Location" &&
5ls /Library/StartupItems >> "Filename/Location"
This will collect the data from the command and put it to a text file if you name the file something like "dataoutput.txt" and you can specify save location too such as "/Users/$USER/Desktop/dataoutput.txt".
I have the exact same question, though more specifically, I'd like to create an extension attribute which lists the contents of /Library/LaunchAgents, /Library/LaunchDaemons, /Library/Startupitems AND their counterparts in ~/Library. My intent is to use this data to look for the presence of Malware.