Ctrl+R gives to cube additional loop edges, but after i merge four it's vertices and turn it into a pyramid, Ctrl+R doesn't work anymore. How can i add loop edges to the pyramid the same way?
If there's a quad there, even if 2 of the vertices in the same place, CtrlR will work.
So select the top face, and scale its vertices to 0 at its center without merging them. (How you do that depends where it is.. e.g with Pivot set to 'Median', Orientation set to 'Normal', with the face selected, that would be SShiftZ 0)
Then cut your loops, and lastly merge the vertices at the tip.
After merging, select all the diagonal edges, select 'Subdivide' from the right-click menu. Set the number of cuts in the Adjust Last Operator panel.
Edge Loop is only reliable in quad based topology, don't expect it to behave nicely when triangles are involved (e.g. pyramids).
In situations like this you can use the knife tool with shortcut K, during the cut you can limit angle with C key and cut-through with Z key, then Enter key to accept. You would want to do this from a side view. If you forget what the special keys are look at the bottom status bar with tells you when you have started the cut.