Probing the mass loss history of carbon stars using CO line and dust continuum emission