The information given here is valid for a Honda Transalp (PD06). Analogously they apply also to other models.
Remove all mounting clamps for the brake line. Open the lid of the reservoir. Suck out the old brake fluid. If you don't have a suitable suction bottle, continue with the next point. Loosen the brake line at the bottom of the brake caliper. The in the line standing (if necessary. Collect the fluid still in the reservoir in a suitable container. Sometimes you have to pump a little bit with the brake lever, or you open the upper bleed valve (older models) resp. Loosen the upper banjo bolt of the brake line a little bit, so that the air can flow in and the brake fluid can flow off more easily.
Unscrew the brake line at the hand brake cylinder and remove the line without letting brake fluid residues get to surrounding parts (wrap a rag around the connector).
If the new brake line is not an original part but a steel braided line, now turn and align the connections according to the old line. Lay the new brake line in the same way as the old one. Screw tight to the brake caliper. Use new sealing rings!
Screw the brake line to the hand brake cylinder. Remove the thread of the brake line or. Screw in the banjo bolt (depending on year of manufacture) carefully as far as possible by hand, the thread in the aluminum cylinder is the same way there!! Use new sealing rings! Now reattach all the fastening clamps. Check the brake line for correct routing. Even if the handlebars are turned in and the fork is spring loaded, the new line must not touch the frame, crash bar or anything else. Make sure that the line is not under tension when the front wheel is unloaded.
Filling and bleeding the brake line
The principle of the following described method I have taken over from Gerd Walter (again thanks at this point). It deviates from the classic brake fluid change/bleeding (fill at the top and pump through to the bottom), but it works really great. After a lot of problems to get the air out of the system, especially with double disc systems, I tested this method and was thrilled. It works really great, so quickly I had the air never out. Open the cover of the reservoir. Suck off the old brake fluid.

Picture 1. Open brake fluid reservoir and siphon off brake fluid
Put a suitable hose on the bleeder valve, open the valve and collect the leaking brake fluid in a suitable container.
Then unscrew the bleed valve completely, clean the thread, seal it with some Teflon tape and screw it in again. Sealing prevents brake fluid from leaking out through the thread when filling via the bleeder valve or. Pull air in with it.
Attach a suitable (short) hose to a plastic syringe (pharmacy) without a cannula. Draw new brake fluid into the syringe, carefully squeeze out the air and put the opposite side of the hose on the bleed valve.

Picture 2. Loosen the bleed valve a little. Slowly press the brake fluid into the line. Make sure that the reservoir does not overflow!
When the reservoir is almost full, close the bleed valve and use the syringe to suck the reservoir almost empty again.
Now press the extracted brake fluid back into the line from below as described above. Repeat this procedure two or three times.

Picture 3. Press the brake fluid into the line with the syringe
Then fill the reservoir and use the syringe to suck out the brake fluid again via the bleed valve until the reservoir is almost empty. Never completely empty the expansion tank, otherwise air can get back into the system!
Repeat this procedure two or three times.
Pump several times with the handbrake lever and test if pressure builds up. If no or insufficient pressure builds up, pull the handbrake lever as far as it will go and hold or lock it. Now carefully loosen the hose on the handbrake lever and release the air there. Before, of course, put a cloth under it, so that the brake fluid does not run uncontrolled somewhere. Tighten the hose again and check again with the handbrake lever if enough pressure is built up. The whole if necessary. Repeat several times.

Picture 4. Bleeding the brake system directly at the hose connection
In between don't forget to check the fluid level in the expansion tank, otherwise you will pump air into the system.
When sufficient pressure is reached, top up the brake fluid level in the reservoir to the prescribed level and close the cap.
Check all connections and fastenings again. Evtl. Clean parts that have come into contact with brake fluid with plenty of water. Then a cautious test drive is called for. After the test ride all connections. Checking the reservoir lid for leaks.