I was able to answer my question after doing more research. The key is to slide the 3x3 kernel and perform Gx and Gy (gradient for the x and y directions) and calculate the output image values. For example, to calculate the output image top left value -
[x - -]
[- - -]
[- - -]
we have to calculate both gradients (x and y)->
Gx
[-1 0 1]
[-1 0 1]
[-1 0 1]
we take the first chunk of the original image (e.g. sliding the kernel over the top values of the input image)
[1 2 4]
[5 2 5]
[5 4 2]
Gx = 4+5+2 - 1-5-5 = 0
Gy = 5+4+2 - 1-2-4 = 4
We take the absolute values of both and sum them so |4| + |0| = 4
And this is the first top value of the output image.
[4 - -]
[- - -]
[- - -]
The same way we calculate the rest. I hope that will help anyone else facing the same problem.