can I use the photosynthesis pathways (map00195 and map00710) from kegg database to know all the related genes?
Yes, you can. You can also use GO terms like photosynthesis.
how I do that with R?
There are many R packages like BiomaRt and KEGGREST that are useful for what you want to do.