A writer is a mental athlete
You have to avoid watching the news and eavesdropping on bad conversations in the same way that professional athletes avoid eating bad foods or participating in activities that might risk injury to their bodies. A writer is a mental athlete. You perform with your mind. Your consciousness is the pool of ink in which you dip your pen. Bad ink, bad writing. If your consciousness is full of reality TV and rumors that Linda tells her friends too loudly on the telephone next door, then your writing will be filled with the same.