I've seen that at the earlier stage coconut is filed with water and, as time passes, the water inside the coconut escapes and a thick layer of white substance forms.
Is the water converted into that white substance?
There is no water escaping from the coconut seed. The transformation of coconut water into coconut meat is explained by the development of the endosperm.
What happens is that, after the (double) fertilization, the endosperm of the coconut forms by nuclear division without cellular division, that is, without the formation of cell walls. This is called nuclear endosperm. According to the Wikipedia link above:
Nuclear endosperm formation → where repeated free-nuclear divisions take place; if a cell wall is formed it will form after free-nuclear divisions. Commonly referred to as liquid endosperm. Coconut water is an example of this. (emphasis mine)
So, in an oversimplification, think about the coconut water as the cytoplasm of a single, huge cell, full of hundreds of nuclei.
After some time, cell walls surrounding the nuclei start to form. This is what we call cellular endosperm. According to the same link:
Cellular endosperm formation → where a cell-wall formation is coincident with nuclear divisions. Coconut meat is cellular endosperm. (emphasis mine)
Therefore, in the coconut, the endosperm is initially nuclear (coconut water) and, after some time, becomes cellular (coconut meat).
According to Abraham and Mathew (1963):
Cellular endosperm development becomes visible in nuts about 6 months old, at which stage a thin coating of jelly-like endosperm tissue is seen around the periphery of the large embryo-sac cavity.
This image shows those two tipes of endosperm (and helobial endosperm as well):