Cooling or heating of gases through energy transfer using lasers