When an object, say a ball, is attracted by the black hole it gets acceleration due to gravity. Suppose light is moving towards the black hole vertical to it... then does it gain acceleration due to gravity? If yes then won't be the speed of light increase and get violated?
I would encourage you to look at the other questions in this territory, but I think they do not directly address the specific question you ask, so I will put an answer here.
You have chosen to look at vertical motion, and it is a good question! I would say that you will not fully understand my or any other answer until you have developed some broader understanding of general relativity, but this does not prevent you getting some sense of the physics even with no such grounding.
The first thing to say is that it is useful to distinguish 'speed of light' from 'coordinate speed of light'. The first quantity can be defined as follows. We suppose that, at any event in spacetime, an observer owns a standard ruler and a standard clock. The observer notices some light go past, and he takes a time measurement, using his standard clock, of how far along his standard ruler the light travels in some small time. Call the time $d\tau$ and the ruler distance $dl$. Such an observer determines that the speed of light is $dl/d\tau$ and it is a prediction of general relativity that he will get the answer $c$ (i.e. 299 792 458 m/s) no matter where or when he is. This is the speed he will find even near a black hole, and even within the event horizon too! He will find it also when gravitational waves are going by, or whatever.
Next let's define the coordinate speed of light. Anywhere in spacetime, one can set up a local coordinate frame, like a scaffold of steel bars or whatever, and label places in the frame by numbers. These numbers give the coordinates of all the places in the frame. They should be assigned in a sensible way (not jumping around arbitrarily) but they don't have to relate to the standard distances measured by a standard ruler. The same can be said for local timing measurements: one can use any sort of reasonably regular process to mark off time. Now suppose an observer watches some light go by, and he notices that it covers a coordinate distance $dx$ during coordinate time $dt$. Then he finds that the coordinate speed of light is $dx/dt$. This speed can take on pretty much any value. Ok, not infinity, but apart from that you might get anything, depending on how your coordinates were defined.
It might seem odd to even bother with this coordinate speed of light idea, but systems of coordinates are so useful in helping us understand what is going on that in fact they are used a lot.
Now to come to your question. As I have already said, when falling toward a massive object, whether a black hole or anything else, the speed of light (i.e. as in the first definition, using local standard clocks and standard rulers) doesn't change. So in this sense the light does not accelerate when it is traveling straight down. However, other properties do change: a wave which at its source had a certain frequency, will be found by observers lower down to have a higher frequency: it is blue-shifted.
However, you probably share with me the intuition that the light is surely 'rushing more and more towards the black hole' as it approaches the horizon. This intuition is half right, half wrong. Owing to the blue shift, it gets harder to reflect the light back out again, as one tries at locations closer to the horizon, because the light carries more energy and momentum (relative to a given local mirror that is being used). On the other hand, there are some very sensible choices of coordinate system in which in fact the coordinate time taken for the light to cover a given coordinate distance gets longer not shorter as the light approaches a horizon!
In addition to the mirror example I just gave, there is another sense of 'rushing towards the horizon' which may be cashed out as follows.
We can imagine building a rigid framework extending in a circle all the way around a black hole, so that it can just sit there encircling the hole and not falling into it. Then observers sitting on the framework can watch light and other things falling past them into the hole. What they will find is that the closer they place such a framework to the horizon, the stronger it will need to be, to prevent being collapsed by the gravity of the hole, until, at the horizon, it becomes impossible to construct any such framework because time itself is carrying all worldlines into the hole.
The forces acting on this framework in order to support it come from the materials science of its construction. They are pushing in the outwards or upwards direction, and one gets a useful insight by noticing that such a framework is itself in a state of permanent acceleration in the outwards (or upwards) direction, relative to any massive body freely falling into the hole.
Finally, let's note another useful observation. Not just light, but also anything moving vertically downwards at locally measured speeds close to the speed of light will not change speed very much as it approaches a black hole (or other massive body), but will gain momentum. Similar observations apply to bodies accelerated by other forces.
My first comment to your question is that it lacks an essential specification. You talk about light "accelerating" but seem not to be aware that to say that is meaningless unless you state before the reference frame where your observations are done.
Note that this isn't peculiar of GR - it holds for whatever statement about motion, even in Newtonian mechanics. In GR it becomes more critical because we are facing with counterintuitive phenomena, like light falling in a gravitational field and yet not increasing its speed.
@AndrewSteane has given an extensive answer which should have clarified the main points, but IMO some specifications are needed. The first is when he speaks of "speed of light" as opposed to "coordinate speed of light". A necessary distinction, Andrew is quite right in emphasizing it. But an event in spacetime isn't enough to define it. Since you need to do measurements having duration in time and extension in space, however small, a frame of reference is required and your event must actually be a - although little - laboratory.
The difference is relevant as an event is just a point in spacetime. You may not speak of "motion" of an event. Instead when you measure a speed it's important to know if your frame is moving - e.g. in free fall - or standing still. Note that my latter words might have no meaning in GR - in a generic spacetime there may be no way of identifying a rest, a standing object.
But in special cases it's possible, and the simplest kind of black hole, the so-called Schwarzschild black hole, is such a case. Andrew himself used that special situation when he spoke of
building a rigid framework extending in a circle all the way around a black hole, so that it can just sit there encircling the hole and not falling into it.
A small portion of that framework, endowed with synchronized clocks, would serve as a lab for your speed measurements. The result for light would be the one Andrew said: you would find the usual $c$ value.
But there is more. In this static spacetime a time coordinate can be defined (usually known as "Schwarzschild time") with the following property. If you have two stationary frames, and send two light signals from one to the other, you get that the difference of their Schwarzschild times at the start is the same as at the arrival. Instead if you used local clocks, built according the same specifications in both labs (e.g. Caesium-133 clocks) they would show the expected "gravitational time dilation".
Time dilation is accompanied by gravitational blueshift (if the receiving lab is lower) and with increased photons energy and momentum. You would see no time dilation if you used a Schwarzschild time coordinate, and this shows a useful property of that time coordinate: time translation invariance.
Light can change direction due to gravity, but its speed does not change. Keeping the same speed but changing direction is acceleration.
Edit: Light that moves vertically in a gravitational field does not speed up or change direction; instead its frequency shifts as it gains or loses gravitational potential.