The Piombino Porto (which I am thinking is what you are calling marittima station as it is the one right at the ferry) is a small connection to the Piombino train station. So once you arrive and get down from the ferry, you can cross and go into the train station and take the short train ride to the Piombino station (it is estimated 15 minute walk, if you were to want to walk it).
You can just buy the ticket for that short ride on the spot before getting on the train - if there is a ticket office, show that you have tickets from Piombino to Levanto, in case they might let you ride that part for free (you never know!)
Otherwise, there are buses from right in front of the biglietteria (ticket office) you can also take to the Piombino train station. Once there, you continue your journey to Levanto.