Hi @Anish2 ,
Offering some generic solutions that you can try -
1) Try pasting using the option retaining source formatting.
2) You can select the code block or even the entire code in the file and apply the code indentation using any IDE such as eclipse and IntelliJ. You can also configure the indentation using IDE settings.
3) Use any online code beautifier for your file.
Regards,
Manpreet