Reading a text file and creating tags

Hey All,
I am trying to read a text file and create tags for each output that is written on the text file. The problem I am having now is, I am just able to grab the entire file. I want to grab specific out values ( string or int) and convert that to a tag. Also want to have it in a loop that way it kinda reads updated data continuously. Please Help!

I created a button and this is my script so far:

path = system.file.openFile(’.txt’)
if path != None:
contents = system.file.readFileAsString(path)
system.tag.writeToTag(“WriteTags/write”, contents) event.source.parent.getComponent(“Text Area”).text = contents