'Iterate through the data and create the needed output.txt file,
appending to file as necessary.'

def create_file(self):

    with open(self.output, 'a') as output_file:
        for data_element in self.data:
            if (data_element.get('module') or data_element.get('function')):
                method_signature = data_element.get('method_signature')
                first_paragraph_text = data_element.get('first_paragraph')
                first_paragraph = ''
                if first_paragraph_text:
                    first_paragraph = '<p>'
                    first_paragraph += first_paragraph_text
                    first_paragraph += '</p>'
                (name, redirect) = self.create_names_from_data(data_element)
                abstract = '<section    class="prog__container">'
                abstract += '{}{}{}'.format(first_paragraph, '', method_signature)
                abstract += '</section>'
                url = data_element.get('url')
                list_of_data = [name, 'A', '', '', '', '', '', '', HOME_LINK, '', '', abstract, url]
                output_file.write('{}\n'.format(' DCTB '.join(list_of_data)))
                if (redirect != name):
                    list_of_data = [redirect, 'R', name, '', '', '', '', '', '', '', '', '', '']
                    output_file.write('{}\n'.format(' DCTB '.join(list_of_data)))
