You really should start by trying to do some actual projects and learn the basics of programming. Start off with the blinking light tutorial, modify it and get a feel for what is happening.
Look at :-http://www.arduino.cc/playground/Main/InterfacingWithHardware
to see about input and output.
In effect yes it is just a matter of pasting the two functions together but if you do this with no understanding it will not work, as you will be pasting things that should not be pasted. For example there should only be one setUp() and one loop() function and each example would have it's own.
Many sensors are different so there is no grantee that the output of one sensor (and hence the interfacing and software) is compatible with another.