Yes, but here are a few helpful hints:
Make sure the cigarette lighter socket works.
In a motorhome, check if the outlet is connected to a separate battery or if it uses the coach or engine battery; use of your CPAP machine may drain your engine battery and prevent you from starting the motor if the outlet connects to the engine battery.
Review and understand how to operate your inverter.
Check your CPAP machine's operations manual to find out if your humidifier will work on 12 volt power.