I read somewhere in a book that mostly desert found in the western part of a continent. So my question is that why is it so? I searched on the internet but I didn't get a reasonable answer for that.
Some of the driest deserts on Earth occur in the western side of continents and they are called Coastal Deserts. Examples of such deserts are the Atacama desert (Chile, the driest desert on Earth), the Baja California desert (USA/Mexico), the Namibia desert (southwestern Africa), and the Atlantic coastal desert of Morocco/western Sahara/Mauritania. In mid-latitudes, the western side of continents is most frequently occupied by deserts, while the eastern side tends to be covered by forests (e.g., Amazon rainforest).
. Distribution of non-polar arid regions. Source: USGS.
Coastal deserts occur east of the strongest coastal upwelling regions in the world. The upwelling is associated with eastern boundary currents flowing equatorward (due to Coriolis): the Canary Current (off Northwest Africa), the Benguela Current (off Southwest Africa), the Humboldt Current (off Chile and Peru), and the California Current (western North America). The prevailing winds in these regions are the trade winds that flow parallel to the coast and generate upwelling dynamics: surface Ekman balance is setup (in deep enough waters) with water transport being to the right (left) of the wind in the northern (southern) hemisphere; this causes a deficit along the coast that needs a compensating flow in the deeper part of the water column bringing cold, nutrient rich waters (some of the most productive regions in the world) to the surface.
The cold waters near the ocean surface results in a cool, stable coastal atmosphere. In this region, evaporation from the ocean is reduced and produces extremely low rainfall over land. Precipitation is limited to morning fog and produces some of the driest ecosystems on Earth. The Atacama desert is the best example of such environment with average rainfalls of 15 mm/year (the driest non-polar region). In some areas, they are trying to take advantage of the little moisture the fog (Camanchaca) brings to establish some agricultural zones. The fog droplets are too small (1-40 micrometers) to form water drops and precipitate, so they use fog-catchers to collect moisture from the fog.
Because of the Coriolis Effect, the prevailing winds on the earth between about the Tropic of Capricorn and the Tropic of Cancer go from the East to the West (knows as the Trade Winds). To get to the west coast of a continent within those latitudes, an air mass blowing from above an ocean must cross the entire continent. Along the way, the air mass causes precipitation (rain, snow, etc.) and loses water so by the time it reaches the west coast the air tends to be very dry and average annual precipitation will be very low.
"Rain shadow" is a related effect in which the lee side of mountain ranges are dry because air masses experience orographic rainfall when they encounter the mountain range. This causes the Atacama desert to the west of the Andes, and the Mojave to the east of the Sierra Nevada. Note that the Mojave is east of the Sierra Nevada rather than west because the prevailing wind direction is westerly (from west to east) because it is north of Capricorn.
Bear in mind that this explanation is extremely approximate and oversimplified, and that your assumption of deserts on the western side of a continent should be reversed north of about Capricorn and South of about Cancer, where the Trade Winds are replaced by the Westerlies.