When your replacing your lever, first thing you have to adjust is the stroke of the Rear Master Cylinder via the turnbuckle which extends from the Master Cylinder (I'm pointing at the turnbuckle). Note that you have to maintain that the Master cylinder arm can fully extend when the lever is in its resting state (you're not touching the lever), otherwise your rear brake won't be able to draw new fluid into the system to account for brake pad wear.
Now you have adjust the Rear Brake light Microswitch via the bolt & nut I'm pointing to. How this is done is, when the rear brake lever is in its resting state, the bolt should just touch the rearset, thus applying inwards pressure to the little black pin that extends from the Microswitch. You can adjust the height of the brake pedal via this bolt as well. If you want the pedal to be lower, then you screw the bolt in so it protrudes farther out the lever. If you made a height adjustment, check the turnbuckle on the master cylinder to make sure it still extends to full stroke.
If the light continues to stay on, then you've probably got a problem with the rear microswitch being faulty and in need of replacement.