These black lines along the walls or under doors and closet doors are called Soil Filtration Lines. What's happening is the air is moving through the walls of the house, being drawn through the edge of the wall, or under a door into a room or closet. The dust in the air is being filtered by the fine fibres of the carpet. Over time this builds up and becomes a very black line.
Most times it can be cleaned off with a little extra effort.
Unfortunately, the longer its been there the more difficult it is to clean and the greater the chance it may not clean 100%.
If you see this black edge developing its an indication that its time for a cleaning.
(See the pictures in the Photo Gallery)