what is this piece for

X3
You do have to have one connected though, either at the points or at the coil for the car to run right.
Basically a "condenser" soaks up the extra arch produced by the points.
They were also used to keep RF interference down for AM radios.

Yes, the one inside the distributor is connected in a different part of the circuit (coil -) and functions differently; it is there to protect the points from arcing and burning. (And I suppose it could be connected to coil - external to the distributor but I don't recall seeing that on older cars.) It does indeed have to be there; the interference suppresor on the + side of the coil does not.