Save parameters in a "key: value" format
There are many things deeply wrong with this method:


It does too much. It seems completely unaware of the single responsibility principle. It's extremely important that every method has one clear main responsibility. This method has so many it's not even clear which one is the most important:


Parse a config file?
Update a config file?
Update an internal hashmap?


You really need to split this up.
The entire method body is wrapped in one giant try-catch block. This is a bad practice. There are many points inside where an exception can be thrown, and by wrapping the entire method like this, you cannot distinguish the failure point and respond gracefully. And since you catch all exceptions and just print on the console (another bad practice by the way), the method will appear to have succeeded, even if it actually failed. As such, the method cannot be trusted.
The way you use MyFormatException is absolutely awful. You throw this poorly named custom exception just to catch it yourself. A simple if statement is the right tool for this, better in every way.
Methods shouldn't be too long in general. Even when they really have a single responsibility. Long methods are hard to understand, test and debug.


A general purpose utility like the one you described and hinted by this implementation can be certainly accomplished in a simpler way.
After you split up this method to smaller functions where each has a clear single responsibility,
the resulting code will be longer than this method.
But it will be composed of smaller component that are easier to understand and test.

There are many other smaller practical problems too:


Declare variables with interface type instead of implementation when possible. For example List instead of ArrayList, like this: List&lt;String&gt; file = new ArrayList&lt;&gt;();
file is a very poor name for a list. It's a list, so name it that way. When I saw file at many places in the code my instinct was that it's probably a File instance, but it's far from it. Very confusing.
The usage this.COMMENT_PREFIX suggests that COMMENT_PREFIX is an instance variables, despite the all capital name which is a convention reserved for static final constants.


I suggest to completely rework this class, splitting up this one big method to smaller methods where each has precisely one responsibility, and post it for another review.