But when I try to fill color, the color overflows outside the boundary:
A question mark appears in the fill tool as well.
How will I fix this?
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
Your shape is actually a bunch of open paths. To fix it you can select the ends of the open paths and hit cmd+J to join the paths. I've circled (I think) the end points of the open paths in the following image; just use the Direct Selection Tool (white arrow) to select the paths I've circled and join, repeat for each area I've circled.
In future, if you're drawing with the Pen Tool and want to continue an existing path rather than drawing a new one you need to start by clicking on the end point of the path you want to continue (The Pen Tool's cursor will have a slash ( / ) next to it when you hover the existing paths end point). Or you can join the paths after the fact as I described.