I created a simple straight line using the Pen Tool. Then I made 3 copies of it and grouped (Ctrl + G) them together to make a square. But now I can't fill a color for it. Even if I do it does not get affected. I wanna fill color just like when i do it with a rectangle tool.
Select all the artwork and use the Live Paint Bucket Tool to fill with color.
The Live Paint tool allows you to fill and color any series of random paths or shapes. It sort of works like a "flood fill tool" in raster applications. It will create closed shapes for areas you wish to fill and then fill them with your chosen color. Note that after using the Live Paint Bucket Tool you do have additional shapes.
It is best to draw shapes as closed paths rather than a series of disjointed lines in most cases. This would eliminate the trouble you are running into.
Grouping the lines has merely oriented the elements together, their points will still need to be joined either with the pen tool (Convert Anchor Points to select then join) or by using the pathfinder and subtracting your lines from a coloured rectangle.
You can also make a square with the rectangle tool by holding shift when drawing on the canvas.