Question: how to create a dmg file?
Answer: In the Disk Utility window, go to the menu on the left and highlight the name of the disk you mounted.
Click on the File menu at the top of the screen. ... 
Type a name for your new file, then navigate to the Desktop to save the file there.
Under Image Format, choose compressed.
Click Save.