Nikhil Patel pretty much beat me to this in the comments on your question, but let me try to offer some more detail.
I'm not 100% sure I'm reading your question correctly, so correct me if I'm wrong on any of this: You have a form on profile.html, which sumbits to storeText.php. StoreText.php writes the file and redirects back to profile.html. Then you want profile.html to display the same $msg variable that got written to the text file, but it isn't doing that. Is that right?
You may have a problem with expecting a .html file to be executed as PHP code. I don't know how your Web server is set up, but normally only .php files are parsed by PHP. You might try renaming profile.html to profile.php and see if that makes a difference. From here on out, I'll be assuming that profile.html is being parsed as PHP; if I'm wrong about that, you'll probably have to rename the file.
The real problem is the redirect. You could take either of two different approaches here. One way to do it would be to include storeText.php in profile.html and have the form submit to profile.html. Then the $msg variable would be available in profile.html and should display. The other approach would be a POST/redirect/GET setup in which the form submitted to storeText.php, which did the work and redirected the user back to profile.html.
The thing is, you can't do both the include and the redirect. That's where you're running into problems. See, each HTTP request from the client, including the new request that the client sends in response to the redirect header, causes your script to be run again from scratch. The brand new profile.html that starts up after the redirect has never seen the $msg variable that contained the value that was written to the file. The reason submitting to profile.html didn't work is that it includes all the code from storeText.php, including the redirect, and even if you redirect to the same file, it's still a new request.
If you want to use the redirect, you'll need some way of storing that variable on the server side so that profile.html can get to it. The usual way of doing this is with sessions. Just have both profile.html and storeText.php set up sessions, have storeText.php save $msg to the session, and have profile.html pull it back out. Then remove the require_once('storeText.php'); line from profile.html, since you don't need that logic there anymore.
If you're not attached to the redirect, then you can do what I normally do (and what Nikhil Patel suggested in the comments). I normally put my form-displaying logic and my form-processing logic in one file, which decides what to do based on whether there's form input. I find this makes it easier to do validation, among other things, but I digress. All you really have to change here is to have the form submit to profile.html (action="" will work fine) and remove the redirect from storeText.php. Then everything will work as you expect.
However, both these approaches are completely wrong if the whole point of what you're doing is to make profile.html output whatever's in the text file, regardless of whether or not you're seeing it right after the form submission. In that case, don't worry about keeping that $msg variable at all. Keep storeText.php pretty much as it is, including the redirect. Remove the include from profile.html. Then, instead of having profile.html just try to echo $msg, have it open the file and echo its contents. (You can even set up a loop to read in one line at a time and put each one in a separate div if you want.)
On re-reading your question, I can't quite tell which behavior you actually want. Your first version of storeText.php only stores the new content in $msg, and uses the fopen/fwrite/etc. functions to append it to the file. So if $msg did survive the redirect (e.g. if you stored it in a session), the user would only see the new bit that was added to the file. The alternate version loads the file into $msg, appends the new content to that, and overwrites the file with $msg. If $msg survived the redirect in that case, the user would see the entire contents of the file.
However, in either case, the user would only see the results right after submitting the form; a fresh GET request to profile.html would still show an empty div. If you want the information to be displayed any time a user views profile.html, reading it from the file is the only option.
By the way, you may already know this but it is worth making explicit anyway: Do not display any values you got from the user without escaping them. If you do, then your page will allow an attacker to input malicious code and have it run in your users' browsers. This applies whether you got the values from the last form input or from a file. Read up on cross-site scripting (XSS) at IT Security StackExchange or OWASP.org.
action=""and putting the PHP on the same page is working for me with file also. You want to display the msg on the same page then why are you redirecting toprofile.html?profile.htmlbecause if not, then when I hit submit a blank page comes up.formwithaction=""and display the message as you've specified in<div class="menuItem" >. It'll work