So I was using the Knife Tool in Adobe Illustrator for cutting shapes. After doing so I realized that the shapes have a gap (line) between them. I need to save my document as a pdf and it has to be in vector form. I would like to know what do I have to change in my work in order to remove the gap between them. Thank you for your answer. :)
I am adding this answer even as this is a duplicate just because the answer suggested as duplicate does not really address the question adequately.
Coverage is not Alpha
There is a general drawing bug in nearly all vector rendering engines anti alias routines. There is this notion that conflates coverage with transparency, thus these are called conflation artifacts.
Even if you have a a perfect edge to edge division it is going to end up wrong.
Imagine your 1 curve covers 50% of the pixel and the other 50% of the pixel. They should thus both contribute half of each pixels value.
Now if you have two transparent filaments on top of each other on a white background you will see 25% of the background 25% of first layer and 50% of the second one.
Clearly transparency and coverage work differently, but the engine treats them as same thing. Everything works like transparency, thus gaps appear where they should be and there is arguably nothing wrong with your image.
This conflation bug does not happen if you do not anti alias, or if you super sample pixels like 3d graphics do anti aliasing routines. So these errors do not affect prints, which is probably why this problem has persisted so long. It is not until very recently that vector art has started to be a release vector art as the main transport mechanism.
How to combat this
Well, your shapes have to overlap its as easy as that. You can simply enlarge the shapes a bit so that they do overlap. Or you can draw flaps under them as described in: