The template generates a single line containing 50 bars plus the battery level. In my case, the last bar and the level would always overflow to the next line. To mitigate this behaviour, I reduced the font size slightly. In addition, I changed the colors to provide more contrast with gray bars, moved the battery level to a separate line, and streamlined the template.
type: markdown
content: >-
{% set bl = states('sensor.your_sensor') | int(0) %}
{% set clr = 'red' if bl < 25 else 'gold' if bl < 75 else 'limegreen' %}
{% set bar = bl//2 %}
##<br><center><font color="{{clr}}"><font size = 4em>{{"|"*bar}}</font><font color="grey"><font size = 4em>{{"|"*(50 - bar)}}</font></center>
<center>{{bl}}%</center>