Read a file line by line assigning the value to a variable

You can read a file line by line and assign it to a variable as shown below