you need to learn to explain your requirements better - just stating that for a small sample of data you need this output is not enough.
Even with the latest output you have although we can give you a solution that will solve that particular case what will happen when, for example, you have 2 ID's on same table with different values?
learn your data - do learn how to do SQL - there are plenty of online courses (free and paid) for you to take.
This particular example is really something that even a junior developer should already know - and if we give you a solution you still won't really understand the why it was done like it.
Below does give the desired output - except for column sec as we don't even know where that is from
select coalesce(a.id, b.id, c.id, d.id) as id
, max(a.name) as Name
, max(b.dept_id) as Dept_Id
, max(c.mail) as Mail
, max(d.contact) as Contact
from #Table1 a
full outer join #Table2 b
on a.id = b.id
full outer join #Table3 c
on b.id = c.id
full outer join #Table4 d
on c.id = d.id
group by coalesce(a.id, b.id, c.id, d.id)