Is this a flexible line between the valve and the dryer? If so I doubt that you can find a cap to fit, and there wouldn't be much to gain anyway. The valve shut the gas off. If you want to remove the valve and replace it with a cap, then you would first have to shut off the gas main, remove the valve, and buy a black iron pipe cap. You would need to use either pipe dope or Teflon tape (Yellow for gas) to properly seal the connection. While this is not a technically difficult job, it requires pipe wrenches and some knowledge of how pipes fit together. From the nature of you question, you may not have these thinks and would be well advised to contact a plumber.