"Ydyn" at the start of this sentence is a question form of the verb "Are they/do they", (This can also be fullfilled with the general form "dyn" i.e. "dyn" doesn't signify positive, negative or a question as do certain longer forms).
The second "Ydyn" simply means "Yes" or can be thought of as "Yes they do/are". This occurs because Welsh doesn't have a single word for "Yes" and "No" and instead it varies upon gramatical context. Contrast this with say "Wyt ti'n mwynhau nofio?" (Do you enjoy swimming?) where the answer is "Ydw" because the answer is "Yes (I do)".
Why is it "ydyn nhw'n" and not "dyn nhw'n"? I thought "ydyn was the written form and the course is based on the spoken form or have I misunderstood the lesson notes or am I missing something else?
If "I am" is "Ydw" and "I am not" is "Nac ydw". What is the "Yes" and "No" answers for the other pronouns: you, he, she, it, we, you all, they? Also, would "Ydw" and "Nac ydw" translate to both: "I am / I am not" and "I do / I do not"?
Pretty much what you would expect: (nac) wyt; (nac) ydy; (nac) ydyn; (nac) ydych; (nac) ydyn. With (nac) oes for “no, there isn’t (any) / yes, there is”.
And yes, as in Wyt ti’n hoffi coffi? Ydw. “Do you like coffee? I do.”