I found out that manually adding resolution of my monitor fixes my problem of not getting the right resolution in the secondary monitor.
I followed the steps in this link which worked out for me.
https://www.tecmint.com/set-display-screen-resolution-in-ubuntu/
1 : list all active monitors.
$ xrandr --listactivemonitors
2 : To add a missing or custom display resolution, you need to calculate the VESA Coordinated Video Timing (CVT) modes for it. You can do this using the cvt utility as follows.
$ cvt 1366 768
3 : Copy the Modeline "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
from the output of the cvt command and use it to create a new mode using the xrandr
$ xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
4 : Then add the new mode to the display.
$ xrandr --addmode DP-1-1 "1368x768_60.00"
5 :Now open the Displays and set the new resolution.
The above changes are only temporary and work for the current session (they last until you log out or restart the system).
To add the resolution permanently, create a script called external_monitor_resolution.sh in the directory /etc/profile.d/.
$ sudo gedit /etc/profile.d/external_monitor_resol.sh
Then add the following lines in the file:
xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
xrandr --addmode DP-1-1 "1368x768_60.00"
Save the changes and exit the file.