Microscopic description of thin film formation in pulsed laser deposition in the presence of a background gas