why a ship made up of steel floats in sea water but a needle sink
Whether a body will float or sink depends on the density of the body. Density of a body is the mass divided by the volume of the body.
Density of an iron pin is more than water so it sinks. The density of a ship is mass of the ship divided by the volume of the ship. Although the ship is made of iron, the volume of the ship is so huge that the density becomes less than the density of water. The reason being, ship is not a mass of solid iron. There is lots of empty spaces and other less dense substances within the volume of the ship.
First of all, an object floats if its overall density is less than the density of the fluid in which it is placed.
The metal ship, due to the large pockets of air inside the ship, has a lower density than water.
The piece of metal has a higher density than water.
Thus, the piece of metal sinks while the metal ship floats.