Another way to diagnose the problem is to connect the monitor to a different system. Additionally, you could boot the system using a bootable USB drive with another OS to check if the lines disappear.
To connect an external monitor to your Mac ... Aside from your external monitor problems, if your Mac is experiencing a lot of issues, you may want to consider doing a full factory reset.