Как прокомментировали другие, просто отслеживайте позицию курсора, когда вы пишете свои данные. Не забудьте учесть символы новой строки (\ n) в ваших строках.
См. Комментарии в коде ...
// create test data
IList<Product> products = new List<Product>()
{
new Product(){ ProductId = 1, Category = "Cat 1", Price = 1.99m, ProductName = "Item 001"},
new Product(){ ProductId = 2, Category = "Cat 1", Price = 2.99m, ProductName = "Item 002"},
new Product(){ ProductId = 3, Category = "Cat 2", Price = 3.99m, ProductName = "Item 003"},
new Product(){ ProductId = 4, Category = "Cat 2", Price = 4.99m, ProductName = "Item 004"},
};
// initialize row/column positions at start
int origColumn = Console.CursorLeft;
int origRow = Console.CursorTop;
int currentColumn = origColumn;
int currentRow = origRow;
// write items to console and keep track of currentRow
foreach (var p in products)
{
Console.WriteLine($"\n\tProductId: {p.ProductId} || Category: {p.Category} || ProductName: {p.ProductName} || Price: {p.Price}");
// add 2; one for each line written and one for each new line character (\n)
currentRow = currentRow + 2;
}
// request input from user and loop request until int type is received
// or user enters 'q' or 'Q' to quit
int selectedProductId = 0;
string inputValue = string.Empty;
do
{
string text = "Type a number ('Q' exit) > ";
Console.WriteLine(text);
currentColumn = text.Length; // set column from text length
Console.SetCursorPosition(currentColumn, currentRow);
inputValue = Console.ReadLine();
int.TryParse(inputValue, out selectedProductId);
currentRow++;
} while (selectedProductId == 0 && !inputValue.Equals("q", StringComparison.InvariantCultureIgnoreCase));
// write selected product detail to console
Product selectedProduct = products.FirstOrDefault(p => p.ProductId == selectedProductId);
if (selectedProduct != null)
{
Console.WriteLine("\nSelected Product Detail:");
Console.WriteLine($"ProductId: {selectedProduct.ProductId} || Category: {selectedProduct.Category} || ProductName: {selectedProduct.ProductName} || Price: {selectedProduct.Price}");
}
else if(!inputValue.Equals("q", StringComparison.InvariantCultureIgnoreCase))
{
Console.WriteLine("Unable to locate that product Id.");
}
Console.WriteLine("\nDone.");