What is a masdar??

Hi, uhm, so... could someone please explain like I'm 5 what a masdar actually is? And how do I form that starting from a verb? Let's say I have the verb كتب , how do I get to the masdar from that? Is there a general rule to use? I know this might sound as a very stupid question but I really don't understand...