The unsightly black lines around the edges of your carpet, especially near heat vents, doorways and walls, are called filtration lines. The cause is fairly simple yet scientific. It’s removing these spots that can be difficult. I’m not aware of any “DIY” remedies that exist.
Air passes through and over the carpet and upholstery in your home which can be considered the lungs of a dwelling, capturing particulate soil, pollution and other nasty substances. Some of the particles become magnetically charged and attach themselves to fibers around areas of restricted air flow, usually around heat vents, doorways and walls. The indoor air quality(IAQ) outside your residence can be over 3 times more toxic than outside.
Don’t despair as there are treatments that break these magnetic bonds. Your trusted professional carpet and rug cleaning company should carry these treatments and know how to properly use them. As with any spot cleaning agent it must be used properly or permanent damage may occur. Again there are no Do It Yourself remedies of which I’m aware.