The photo is too washed out to see what you are referring to, but putting a plug in the end of a fitting IS the right way to terminate A generic drain line. BUT it may not be the way to terminate YOUR drain line, depending on other factors your photo and description may not tell us, such as WHY that fitting is there.