Make sure you get your ticket from a machine - you pay more if you get it from the ticket counter.
If you are flying into HAM you can buy your ticket at the airport and it will include the S-Bahn to the station.
At the Lübeck end of the journey your train ticket is valid for a bus journey anywhere in the central zone (which extends a fair way into the suburbs)