output related tags to file