In this case, this won't work. Melodic is only found on Ubuntu 18.
ROS has a strict versioning scheme that aligns with different versions of Ubuntu. Ex:
Ubuntu 14 (aka Trusty) == ROS Indigo
Ubuntu 16 (aka Xenial) == ROS Kinetic
Ubuntu 18 (aka Bionic) == ROS Melodic
Ubuntu 20 (aka Focal) == ROS Noetic