I have a list of Persian words and a file which contains a sentence, a tab and then an English word in each line. I want to check if each word in each line of the file, exist in the list, the code returns "1", and if not, it returns "0". For example, if my list contains 20 words and my file has 50 lines, the code should return 50 rows with 20 columns of 1 and 0 and a column of that English word at the end. (In fact 21 columns). And between each number should be a comma (as like as the picture below). And finally I want to write them in a new file. The code below just returns one column. How can I fix it? thanks