How to get housing seated into shifter barrel adjuster
I think that bit of plastic on the end of the housing is called the "ferrule".

If you have a spare and want to replace it you have to get the inner cable out which means cutting the cap off the far end of it (down by the derailleur) and pulling the cable out. Then you put another cap on the far end after replacing the ferrule.

The shifter end of the cable has a lump of metal permanently attached to it so it can't be unthreaded from that end. 

I think it would also probably work fine to just clean it up as best you can and put a couple of drops of superglue between the housing and the ferrule. That way you don't need to take the inner out.