Hello Roshan,
In DCE mode, UART_CTS is used to control data IO directions, you multiplexed RTS to be GPIO and used it to control TX/RX , exactly, which will cause data to be lost. Because you don't know when TX / RX is done. RS485 is half-duplex communication.
For RS485 design, I have 3 suggestions for you :
1. Using UART CTS to control IO direction of data.
This is supported by UART IP, you can find the function in i.MX6UL Reference manula.
2. Using Hardware control it, don't need any code in software.

3. Using GPIO to control DE/RE#
Since you used GPIO to do it, I think you should check the "empty interrupt" of UART TX FIFO , if the interrupt occurs, GPIO should be switched to RECEIVE (maybe pull it down to LOW)
Have a nice day!
NXP TIC weidong sun