Assalamu is one word followed by a space and then 'alaykum
You are right about having space between two words. However in your examples Assalamu is one word and not two (assala+mu). Hope this helps. May the Almighty grant you success in learning this great language :)