How the onion skin structure of a star is formed