Q.yucca elephentitis indoor plant
I cut the greenery from the stem of Yucca trunk and put them in water to root. Is this the right procedure? Will the plant rot if I keep it in water? – I did not mean greenery as in the leaves. I meant removed the plants from the trunk, came home and put in water. Is it ok to keep in water or does it really have to be potted in dirt?

No, the leaves do not contain the vegetative organisms for the yucca, you need to use the stem. This article will tell you more: https://www.gardeningknowhow.com/ornamental/foliage/yucca/propagation-of-yucca-plant.htm
You can put the leaves into water for a decorative effect, however, they last quite a while.