While pulling the piston,pressure inside the syringe decreases as compared to the atmospheric pressure,actually,its tube is empty.hence when there is liquid on the outside of the needle, it gets pulled into the empty space by
the vacuum. This is because the liquid pushes up against the hole at
the end of the needle, but since there's no air or anything there to
push back on it, it rushes in.