Hi Pratima,
Where are you reading/writing the file, because locally you would have more permissions to access files than the Mendix app would have on a deployed environment.
If you need something temporary to read/write you can consider the TempPath
https://apidocs.rnd.mendix.com/10/runtime/com/mendix/core/conf/Configuration.html#getTempPath or the Resources folder (use CommunityCommons GetFileContentsFromResource to access that file).
Maybe you can share a bit more what you are trying to achieve and why you need that specific approach
I also have this problem, did you solve it?