Berserk.
Whenever the golem starts its turn with 40 hit points or fewer, roll a d6. On a 6, the golem goes berserk. On each of its turns while berserk, the golem attacks the nearest creature it can see. If no creature is near enough to move to and attack, the golem attacks an object, with preference for an object smaller than itself. Once the golem goes berserk, it continues to do so until it is destroyed or regains all its hit points.
The golem's creator, if within 60 feet of the berserk golem, can try to calm it by speaking firmly and persuasively. The golem must be able to hear its creator, who must take an action to make a DC 15 Charisma (Persuasion) check. If the check succeeds, the golem ceases being berserk. If it takes damage while still at 40 hit points or fewer, the golem might go berserk again.
Immutable Form. The golem is immune to any spell or effect that would alter its form.
Lightning Absorption. Whenever the golem is subjected to lightning damage, it takes no damage and instead regains a number of hit points equal to the lightning damage dealt.
Magic Resistance. The golem has advantage on saving throws against spells and other magical effects.
Magic Weapons. The golem's weapon attacks are magical.
Multiattack. The golem can make two attacks of which only one can be Flame breath.
Slam. Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 19 (3d8 + 6) bludgeoning damage.
Fire Breath (Recharge 5-6): The golem exhales fire in a 15-foot cone. Each creature in that area must make a DC 13 Dexterity saving throw, taking 24 (7d6) fire damage on a failed save, or half as much damage on a successful one.
Enter the description for how legendary actions work for your monster here.
Legendary Action Name (Costs # Actions). Enter the description for your legendary action.
Description
The earliest known example of a demonflesh golem was built from the remains of a demon named Llargash, who was defeated in the Blood War by a powerful devil named Maligothez. Maligothez stripped the flesh from Llargash's corpse, and, after some alchemical experimentation, grafted the flesh to the skeleton of a troll and reanimated the resulting monstrosity. Maligothez was ultimately slain by rival devils, but his creation outlived him, and managed to take revenge against many of its masters attackers. Since that time, the creation of demonflesh golems has become something of a perverse sport amongst many inhabitants of the Nine Hells.