I killed it and I don't know what to do! Please help! Edit: the game I have is Pokemon diamond
Unlike in later games, such as Platinum and HeartGold/SoulSilver, there is no way to respawn a legendary if you flee from it or knock it out. Thus, in Diamond and Pearl, you only have one shot to catch each legendary Pokémon, and you must capture either Dialga or Palkia respectively to advance.
Source
If you saved then it is too late, but if you haven't yet, soft reset (l+r+start). Then you can try to find it again