What is the direction of vertical component of earth magnetic field is it upward or downward?
You confusion might well be the confusion experienced by many other students.
I have annotated the diagram to help with my explanation.
Near the geographic North Pole is what is called the magnetic North Pole.
The pole on a bar magnet (compass) which points towards the North is called the north (seeking) pole and they such poles are labelled $n$ in the diagram.
It is that pole which you call the north pole of a magnet.
By convention the direction of magnetic field lines is from the north pole of a bar magnet towards the south pole of bar magnet.
So in the Northern Hemisphere the magnetic field lines due to the Earth point into the Earth, ie the vertical component of the Earth’s field is downwards.
A complication arises if you want to liken the Earth’s magnetic field to that produced by a large bar magnet inside the Earth. Since the magnetic field lines due to the Earth are in a northerly direction the pole of the bar magnet inside the Earth nearest the magnetic north pole must be a south pole labelled $S$ in the diagram.