The answer to 'how to replace electrical wiring' is to hire a licensed electrician to safely and properly replace the wiring in your home. Attempting to replace electrical wiring yourself can be extremely dangerous and may result in fire, electrocution, or other serious hazards. Electrical work should only be performed by trained professionals who understand local building codes and safety regulations.
If your home has outdated or damaged wiring, it's important to have it inspected and replaced as soon as possible to ensure the safety of your family. An electrician will be able to assess the condition of your home's wiring and provide a recommended course of action. They can then safely remove the old wiring and install new, up-to-code electrical wiring throughout your home.