I'm confused when I have to write "Ok" in a writing, because I don't know if "OK" and "Ok" are both orthographically correct or just one is.
You don't write Usa or USa for USA because USA is the abbreviation for the United States of America.
However, there are many forms of abbreviations in English and there is no hard-and-fast rule. For example, you abbreviate mister to Mr. or Mr and Doctor of Philosophy to PhD.
You could write Ok or ok in a text message or informal writing, but you should use one of the following three in formal writing. I would prefer OK to O.K..
The important thing to understand is:
OK is written as if it were an an acronym even though it doesn't stand for anything but itself.
So, the common practice in print is to write OK or O.K. or okay but not Ok.
There are various hypotheses about the origin of OK, like "oll korrect" (a joke misspelling for "all correct") or "Old Kinderhook" (a nickname of Martin Van Buren), but few people have heard of those things, and really, nobody knows. The origin of OK doesn't matter, because when people use the word today, they are not invoking an ongoing tradition in which the letters stand for something other than the spoken word "okay".
Some people say that OK stands for "okay" in the same way that IOU (as a noun, as in "I'll give you an IOU for $6") stands for the phrase "I owe you". As a theory of the origin of OK, that's probably wrong. But it correctly explains how the word OK communicates today and why it's customary to write it with two capital letters. When people write "IOU", they expect the reader to understand that the letters stand for "I owe you" because the names of the letters sound the same as the words. When people write "OK", they do not expect the reader to understand that the letters stand for "oll korrect". They do expect the reader to understand it as meaning "okay", which is pronounced the same as the letters "OK".