How could Hiramekarei defeat Samehada? Refer to episode 31, boruto.

Hiramekarei stores chakra and then release it in shapes. 

Why then, Samehada don't just absorb all that chakra? How could it defeat Samehada at all?
There is no "specific power ranking" for the seven legendary swords, and as stated in the comments, a weapon is only as powerful as its wielder. Choujiro proved this when he defeated one of "new generation -seven legendary swordsmen" with a normal sword.

Apart from the fact that it was Shizumas first time attempting to use Samehada, it is important to note that


  Samhehada is the only living weapon among the seven legendary swords, and as such, it has its own consciousness and personality. Therefore its actions can affect the tide of battle. Samehada was already absorbing all their chakra using the "bloody mist absorption technique" but that only made it want more chakra.


Samehada is actually a greedy Glutton, that loves chakra more than anything else, and it takes a large amount of will power and experience to tame it. Unfortunately for Shizuma, he could not control Samehada and so it took over his body and started going on a rampage. At that point, Shizuma was not thinking straight and he was also at a disadvantage going against two "Jonin level" kids.

The loss was not because Hiramekarei is stronger or weaker but merely due to the circumstances in which the battle took place.