Hi Shobhit Patodi,
If you want to add a underline to your text, you can add custom styling to the text widget in style section area. Best practice is, add the class name to the widget and create one .scss file in your theme folder of the project directory. Add your custom styling with your mentioned class name of the text widget. Then, use Calypso tool or Koala Compiler to compile the .scss files.
You can add styling inside the Appearance tab style area like this. But it’s not a good practice.
For your reference, I m sharing the documentation for how to use Calypso tool for Custom styling.
Thanks and Regards,