Select the XYZ Extract from Entities ->XYZ command.
After starting the command the following dialog box opens.
First press the button Select entities and select all the 3D AutoCAD entity points that you want to save as XYZ file.
Press the button QS file name to save the XYZ file. Define the file location.
Confirm with OK.