There are two water lines connected to water heater.
One is marked Hot and the other Cold.
The shut off valve is on the Cold line.
To eliminate sand and dirt from entering your water heater, the 'sediment' filter should be installed on Cold line.
Sand and dirt are sometimes called sediment, but this type of sediment is not the same as calcium carbonate sediment that accumulates inside a tank that receives hard water.
When you have hard water, then water heater makes calcium carbonate 'sediment' deposits that accumulate in bottom of tank. A 'sediment' filter will not prevent this problem.http://waterheatertimer.org/Clean-sediment-out-of-water-heater.htmlhttp://waterheatertimer.org/How-to-clean-sediment-out-of-electric-water-heater.html
If you have hard water, to prevent calcium carbonate from forming inside tank, you need a water softener.
Water softener will prevent calcium carbonate sediment forming inside tank.
However water softener will shorten life of water heater anode rod.http://waterheatertimer.org/Replace-anode-rod.html
Add a comment for more free help.
Also take advantage of fixya phone service.
For a price, fixya expert speaks with you over phone while you work on water heater.