To be very technical about it ... you didn't say what the reference is for the passenger's "2 m/s". Is that relative to the ship, or relative to the dock ?
In fact, you didn't tell us the reference for the ship's "12 m/s" either.
I think I know how you meant it all, and if I'm correct, you actually switched
reference frames during the question and didn't tell us.
I have a hunch that the ship is moving at 12 m/s relative to the dock, and the
passenger is walking at 2 m/s relative to the ship.
That means that the passenger is moving at (12 + 2) = 14 m/s relative to
the dock, and after doing this for 3 seconds, he is 42 meters closer to the
dock than he was when the story began.
That's the sum of (12 x 3) = 36 meters that the ship has carried him
relative to the dock, plus the (2 x 3) = 6 meters that he has walked
along the deck of the ship.