how to get overdue complaints using join two tables
You can't create an interval like that. To have a variable number of months,  create a 1 month interval and multiply it with your number of months. 

You also need to compare the result of adding the interval to the completion date to something. I assume you want to compare it to "today":

select comp.complaint_id 
from complaints as comp 
  JOIN template as tmpl ON comp.templateid = tmpl.id 
where comp.completion_date + interval '1 month' * tmpl.template_month &lt; current_date;


Online example: https://rextester.com/JGNX75589